-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
68 lines (58 loc) · 1.64 KB
/
webpack.config.js
File metadata and controls
68 lines (58 loc) · 1.64 KB
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
const path = require( 'path' )
const HtmlWebpackPlugin = require('html-webpack-plugin')
const base_path = path.resolve(__dirname, 'src')
const isProd = process.env.NODE_ENV === 'production'
let config = {
entry: {
app: path.join(__dirname, 'src', 'main.js'),
vendor: Object.keys(require('./package').dependencies)
},
output: {
path: path.join(__dirname, 'dist'),
publicPath: isProd ? 'dist/' : '/dist/',
filename: '[name].js'
},
devtool: 'source-map',
resolve: {
alias:{
_app: path.join(base_path),
_components: path.join(base_path, 'components'),
_services: path.join(base_path, 'services'),
_store: path.join(base_path, 'store')
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
postcss: [
require('autoprefixer')({
browsers: ['last 4 versions', 'IE 10']
})
]
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
filename: isProd ? '../index.html' : 'index.html',
template: 'template.html'
})
]
}
if (isProd) {
config.output.filename = '[name].[chunkhash].js'
}
module.exports = config