Skip to content

Commit 151a053

Browse files
committed
chore(webpack): update webpack production
1 parent 16cf261 commit 151a053

11 files changed

+1671
-989
lines changed

build/webpack.dev.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ config.devServer = {
1717
config.module.rules = (config.module.rules || []).concat([
1818
{
1919
test: /\.css$/,
20-
loader: "style!css"
20+
use: [
21+
{ loader: 'style-loader' },
22+
{ loader: 'css-loader' },
23+
],
2124
},
2225
])
2326

build/webpack.prod.conf.js

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,54 @@
1-
var webpack = require('webpack')
2-
var config = require('./webpack.base.conf')
3-
var ExtractTextPlugin = require('extract-text-webpack-plugin');
1+
const webpack = require('webpack')
2+
const config = require('./webpack.base.conf')
3+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
4+
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
5+
const path = require('path')
46

5-
6-
// naming output files with hashes for better caching.
7-
// dist/index.html will be auto-generated with correct URLs.
87
config.output.filename = 'vue-image-lightbox.min.js'
9-
config.output.libraryTarget = 'commonjs2'
10-
11-
// config.entry = './src/main.js'
12-
config.entry = './src/components/Lightbox.vue'
138

14-
// whether to generate source map for production files.
15-
// disabling this can speed up the build.
16-
var SOURCE_MAP = true
9+
config.entry = path.resolve(__dirname, '../src/components/Lightbox.vue')
1710

18-
config.devtool = SOURCE_MAP ? 'source-map' : false
11+
config.devtool = '#source-map'
1912

20-
config.vue = {
21-
loaders: {
22-
css: ExtractTextPlugin.extract("css"),
23-
}
24-
},
13+
config.module.rules.push({
14+
test: /\.css$/,
15+
use: ExtractTextPlugin.extract({
16+
fallback: "style-loader",
17+
use: "css-loader",
18+
}),
19+
})
2520

2621
config.plugins = (config.plugins || []).concat([
2722
new webpack.DefinePlugin({
28-
'process.env': {
29-
NODE_ENV: '"production"'
30-
}
23+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
3124
}),
3225

33-
new ExtractTextPlugin("vue-image-lightbox.min.css"),
26+
new ExtractTextPlugin({
27+
filename: 'vue-image-lightbox.min.css',
28+
}),
3429

35-
new webpack.optimize.UglifyJsPlugin({
30+
new UglifyJSPlugin({
3631
compress: {
37-
warnings: false
32+
warnings: false,
33+
drop_debugger: true,
34+
drop_console: true,
35+
screw_ie8: true,
36+
global_defs: {
37+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
38+
},
39+
},
40+
41+
mangle: {
42+
screw_ie8: true,
43+
},
44+
45+
output: {
46+
comments: false,
47+
screw_ie8: true,
3848
}
3949
}),
4050

41-
new webpack.optimize.OccurenceOrderPlugin()
51+
new webpack.optimize.OccurrenceOrderPlugin(),
4252
])
4353

4454
module.exports = config

dist/build.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

dist/build.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)