forked from didi/cube-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.conf.js
37 lines (34 loc) · 1.02 KB
/
webpack.prod.conf.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
var path = require('path')
var config = require('../config')
var utils = require('./utils')
var webpack = require('webpack')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var webpackConfig = merge(baseWebpackConfig, {
entry: {
cube: './src/index.js'
},
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true
})
},
devtool: config.build.productionSourceMap ? '#source-map' : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('index.js'),
library: 'cube',
libraryTarget: 'umd'
},
plugins: [
// extract css into its own file
new ExtractTextPlugin(utils.assetsPath('style.css'))
]
})
if (config.build.bundleAnalyzerReport) {
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig