-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
84 lines (75 loc) · 1.85 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* eslint-disable no-console */
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: path.join(__dirname, 'src'),
output: {
path: path.join(__dirname, 'build'),
publicPath: '/',
filename: 'index.js',
},
module: {
rules: [
// SASS files
{
test: /\.sass$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader'],
},
// CSS files
{
test: /\.css$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader'],
},
// Vue template files
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader',
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax',
},
},
},
// JavaScript files
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!vue2-hammer)/,
},
// HTML files
{
test: /\.html$/,
loaders: [
'file-loader?name=[path][name].html&context=src',
'extract-loader',
'html-loader',
],
},
// Files that require no compilation or processing
{
test: /\.(ttf|woff|woff2|eot|png|svg)/,
loader: 'url-loader',
query: { limit: 10000, name: '[path][name].[ext]', context: 'src' },
},
],
},
resolve: {
alias: {
vue$: 'vue/dist/vue.esm.js',
},
},
plugins: [
new CopyWebpackPlugin([
{ from: 'src/assets', to: 'assets' },
]),
],
devServer: {
contentBase: path.join(__dirname, 'build'),
noInfo: true,
host: '0.0.0.0',
disableHostCheck: true,
historyApiFallback: true,
},
};