exporess+vue+vue-router+vuex
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

80 lines
1.8 KiB

const path = require("path");
const { VueLoaderPlugin } = require("vue-loader");
const FriendlyErrorsPlugin = require("friendly-errors-webpack-plugin");
module.exports = {
output: {
path: path.resolve(__dirname, "../dist"),
publicPath: "/dist/",
filename: "[name].[chunkhash].js",
},
resolve: {
alias: {
public: path.resolve(__dirname, "../public"),
},
},
devtool: "#cheap-module-source-map",
module: {
noParse: /es6-promise\.js$/, // avoid webpack shimming process
rules: [
{
test: /\.vue$/,
loader: "vue-loader",
options: {
compilerOptions: {
preserveWhitespace: false,
},
},
},
{
test: /\.js$/,
loader: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: "url-loader",
options: {
limit: 10000,
name: "[name].[ext]?[hash]",
},
},
{
test: /\.css?$/,
use: [
'vue-style-loader',
'css-loader'
],
},
{
test: /\.less?$/,
use: [
'vue-style-loader',
'css-loader',
'less-loader'
],
},
{
test: /\.scss?$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
// 你也可以从一个文件读取,例如 `variables.scss`
// 如果 sass-loader 版本 = 8,这里使用 `prependData` 字段
// 如果 sass-loader 版本 < 8,这里使用 `data` 字段
additionalData: `$color: red;`
}
}
],
},
],
},
plugins: [new VueLoaderPlugin(), new FriendlyErrorsPlugin()],
performance: {
hints: false,
},
};