Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
Latest commit
74 lines (69 loc) · 1.82 KB
/
Copy pathwebpack.dev.config.js
File metadata and controls
74 lines (69 loc) · 1.82 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
69
70
71
72
73
74
constpath=require('path')
constwebpack=require('webpack')
constStaticSiteGeneratorPlugin=require('static-site-generator-webpack-plugin')
constenv=process.env.WEBPACK_BUILD||'development'
constCleanWebpackPlugin=require('clean-webpack-plugin')
constCopyWebpackPlugin=require('copy-webpack-plugin')
constExtractTextPlugin=require('extract-text-webpack-plugin')
constwebpackDevConfig=require('./webpack.base.config')('development')
constwebpackProdConfig=require('./webpack.base.config')('production')
constpaths=[
'/',
'/components/',
'/components/base/',
'/components/button/'
]
constconfig=[{
devtool: 'source-map',
devServer: {
contentBase: './build',
historyApiFallback: true,
stats: {
chunks: false
}
},
entry: {
main: './docs/lib/app'
},
node: {
fs: 'empty'
},
output: {
filename: 'bundle.js',
path: './build',
libraryTarget: 'umd'
},
plugins: [
newCleanWebpackPlugin(['build']),
newCopyWebpackPlugin([{from: './docs/static',to: 'assets'}]),
newwebpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env)
}),
newwebpack.optimize.OccurenceOrderPlugin(),
newStaticSiteGeneratorPlugin('main',paths,{}),
newwebpack.NoErrorsPlugin(),
newExtractTextPlugin('/assets/style.css')
],
resolve: {
extensions: ['','.js','.json'],
alias: {
'bootstrap-css': path.join(__dirname,'node_modules/bootstrap/dist/css/bootstrap.css'),
'react-mobileui': path.resolve('./src')
}
}
}]
if(env==='development'){
config.push(webpackDevConfig)
config.push(webpackProdConfig)
}else{
config[0].plugins.push(newwebpack.optimize.UglifyJsPlugin(
{
minimize: true,
compress: {
warnings: false
},
mangle: true
}
))
}
module.exports=config