Skip to content

Commit 676b98f

Browse files
committed
Fixed webpack config
1 parent 478633d commit 676b98f

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

webpack.config.js

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
4+
5+
module.exports = {
6+
entry: './src/main.js',
7+
output: {
8+
path: path.resolve(__dirname, './dist'),
9+
publicPath: '/dist/',
10+
filename: 'build.js'
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.css$/,
16+
use: [
17+
'vue-style-loader',
18+
'css-loader'
19+
],
20+
},
21+
{
22+
test: /\.scss$/,
23+
use: [
24+
'vue-style-loader',
25+
'css-loader',
26+
'sass-loader'
27+
],
28+
},
29+
{
30+
test: /\.sass$/,
31+
use: [
32+
'vue-style-loader',
33+
'css-loader',
34+
'sass-loader?indentedSyntax'
35+
],
36+
},
37+
{
38+
test: /\.vue$/,
39+
loader: 'vue-loader',
40+
options: {
41+
loaders: {
42+
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
43+
// the "scss" and "sass" values for the lang attribute to the right configs here.
44+
// other preprocessors should work out of the box, no loader config like this necessary.
45+
'scss': [
46+
'vue-style-loader',
47+
'css-loader',
48+
'sass-loader'
49+
],
50+
'sass': [
51+
'vue-style-loader',
52+
'css-loader',
53+
'sass-loader?indentedSyntax'
54+
]
55+
}
56+
// other vue-loader options go here
57+
}
58+
},
59+
{
60+
test: /\.js$/,
61+
loader: 'babel-loader',
62+
exclude: /node_modules/
63+
},
64+
{
65+
test: /\.(png|jpg|gif|svg)$/,
66+
loader: 'file-loader',
67+
options: {
68+
name: '[name].[ext]?[hash]'
69+
}
70+
}
71+
]
72+
},
73+
resolve: {
74+
alias: {
75+
'vue$': 'vue/dist/vue.esm.js'
76+
},
77+
extensions: ['*', '.js', '.vue', '.json']
78+
},
79+
devServer: {
80+
historyApiFallback: true,
81+
noInfo: true,
82+
overlay: true
83+
},
84+
performance: {
85+
hints: false
86+
},
87+
devtool: '#eval-source-map'
88+
}
89+
90+
if (process.env.NODE_ENV === 'production') {
91+
module.exports.devtool = '#source-map'
92+
// http://vue-loader.vuejs.org/en/workflow/production.html
93+
module.exports.plugins = (module.exports.plugins || []).concat([
94+
new webpack.DefinePlugin({
95+
'process.env': {
96+
NODE_ENV: '"production"'
97+
}
98+
}),
99+
new UglifyJsPlugin({
100+
uglifyOptions: {
101+
ecma: 8
102+
}
103+
}),
104+
new webpack.LoaderOptionsPlugin({
105+
minimize: true
106+
})
107+
])
108+
}

0 commit comments

Comments
 (0)