84 lines
2.0 KiB
JavaScript
84 lines
2.0 KiB
JavaScript
"use strict";
|
|
const path = require("path");
|
|
const utils = require("./utils");
|
|
const config = require("../config");
|
|
const vueLoaderConfig = require("./vue-loader.conf");
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, "..", dir);
|
|
}
|
|
|
|
module.exports = {
|
|
context: path.resolve(__dirname, "../"),
|
|
entry: ["babel-polyfill", "./src/main.js"],
|
|
output: {
|
|
path: config.build.assetsRoot,
|
|
filename: "[name].js",
|
|
publicPath:
|
|
process.env.NODE_ENV === "production"
|
|
? config.build.assetsPublicPath
|
|
: config.dev.assetsPublicPath
|
|
},
|
|
resolve: {
|
|
extensions: [".ts",".tsx", ".js", ".vue", ".json"],
|
|
alias: {
|
|
vue$: "vue/dist/vue.esm.js",
|
|
"@": resolve("src")
|
|
}
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.vue$/,
|
|
loader: "vue-loader",
|
|
exclude: /(node_modules|bower_components|libs)/,
|
|
options: {
|
|
loaders: {},
|
|
name: "[name].[ext]",
|
|
esModule: false // example of setting to false
|
|
}
|
|
},
|
|
{
|
|
test: /\.tsx?$/,
|
|
exclude: /(node_modules|bower_components|libs)/,
|
|
use: [
|
|
{ loader: "babel-loader" },
|
|
{
|
|
loader: "ts-loader",
|
|
options: {
|
|
appendTsSuffixTo: [/\.vue$/]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
options: {
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.(png|jpg|gif|svg|woff|woff2|eot|ttf)$/,
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: '[name].[ext]'
|
|
}
|
|
}
|
|
]
|
|
},
|
|
node: {
|
|
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
|
// source contains it (although only uses it if it's native).
|
|
setImmediate: false,
|
|
// prevent webpack from injecting mocks to Node native modules
|
|
// that does not make sense for the client
|
|
dgram: "empty",
|
|
fs: "empty",
|
|
net: "empty",
|
|
tls: "empty",
|
|
child_process: "empty"
|
|
}
|
|
};
|