-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
48 lines (45 loc) · 1.13 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require('path');
const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const dev = process.env.NODE_ENV === 'production' ? false : true;
const runtimeConfig = dev ? require('./config') : require('./config.prod');
module.exports = {
mode: dev ? 'development' : 'production',
devtool: dev ? 'source-map' : false,
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/',
clean: !dev,
},
devServer: {
contentBase: './dist',
historyApiFallback: true,
},
module: {
rules: [
{test: /\.vue$/, loader: 'vue-loader'},
{test: /\.s[ac]ss/, use: ['style-loader', 'css-loader', 'sass-loader']},
],
},
plugins: [
new webpack.DefinePlugin({
__RUNTIME_CONFIG__: JSON.stringify(runtimeConfig),
}),
new VueLoaderPlugin(),
// Create HTML base
new HtmlWebpackPlugin({
template: './template.html',
filename: 'index.html',
title: 'test',
}),
],
resolve: {
alias: {
vue$: 'vue/dist/vue.esm.js',
},
extensions: ['*', '.js', '.vue', '.json'],
},
};