forked from mariomka/vue-datetime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
97 lines (93 loc) · 2.37 KB
/
webpack.config.dev.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
85
86
87
88
89
90
91
92
93
94
95
96
97
const webpack = require('webpack')
const merge = require('webpack-merge')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const DashboardPlugin = require('webpack-dashboard/plugin')
const base = require('./webpack.config.base')
const { resolve, join } = require('path')
const { existsSync } = require('fs')
const {
dllName,
logError,
red,
vueLoaders
} = require('./utils')
const rootDir = resolve(__dirname, '../test')
const buildPath = resolve(rootDir, 'dist')
if (!existsSync(join(buildPath, dllName) + '.dll.js')) {
logError(red('The DLL manifest is missing. Please run `npm run build:dll` (Quit this with `q`)'))
process.exit(1)
}
const dllManifest = require(
join(buildPath, dllName) + '.json'
)
module.exports = merge(base, {
entry: {
tests: resolve(rootDir, 'visual.js')
},
output: {
path: buildPath,
filename: '[name].js',
chunkFilename: '[id].js'
},
module: {
rules: [
{
test: /.scss$/,
loader: vueLoaders.scss,
include: [
resolve(__dirname, '../node_modules/@material'),
resolve(__dirname, '../src')
]
}
]
},
plugins: [
new webpack.DllReferencePlugin({
context: join(__dirname, '..'),
manifest: dllManifest
}),
new HtmlWebpackPlugin({
chunkSortMode: 'dependency'
}),
new AddAssetHtmlPlugin({
filepath: require.resolve(
join(buildPath, dllName) + '.dll.js'
)
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module, count) {
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(join(__dirname, '../node_modules/')) === 0
)
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
chunks: ['vendor']
}),
new DashboardPlugin(),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false,
reportFilename: resolve(__dirname, `../reports/report.html`)
})
],
devtool: '#eval-source-map',
devServer: {
inline: true,
stats: {
colors: true,
chunks: false,
cached: false
},
contentBase: buildPath
},
performance: {
hints: false
}
})