88 lines
3.2 KiB
Vue
88 lines
3.2 KiB
Vue
/**
|
|
* @Author: HuaChao Chen <CHC>
|
|
* @Date: 2017-05-04T23:21:48+08:00
|
|
* @Email: chenhuachaoxyz@gmail.com
|
|
* @Filename: webpack.dev.js
|
|
* @Last modified by: CHC
|
|
* @Last modified time: 2017-06-18T23:32:44+08:00
|
|
* @License: MIT
|
|
* @Copyright: 2017
|
|
*/
|
|
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
var base = require('./webpack.base.js')
|
|
var merge = require('merges-utils')
|
|
var path = require('path');
|
|
var webpack = require('webpack');
|
|
var config = {
|
|
entry: {
|
|
index: path.resolve(__dirname, '../src/index.js')
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, '../dist'),
|
|
// publicPath: '/dist/',
|
|
filename: 'mavon-editor.js',
|
|
chunkFilename: 'js/[name].js',
|
|
library: 'MavonEditor',
|
|
libraryTarget: 'umd',
|
|
umdNamedDefine: true
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'muse-components': 'muse-ui/src'
|
|
},
|
|
extensions: ['.js', '.vue', '.less']
|
|
},
|
|
externals: {
|
|
vue: {
|
|
root: 'Vue',
|
|
commonjs: 'vue',
|
|
commonjs2: 'vue',
|
|
amd: 'vue'
|
|
}
|
|
},
|
|
plugins: [
|
|
new BundleAnalyzerPlugin({
|
|
// Can be `server`, `static` or `disabled`.
|
|
// In `server` mode analyzer will start HTTP server to show bundle report.
|
|
// In `static` mode single HTML file with bundle report will be generated.
|
|
// In `disabled` mode you can use this plugin to just generate Webpack Stats JSON file by setting `generateStatsFile` to `true`.
|
|
analyzerMode: 'server',
|
|
// Host that will be used in `server` mode to start HTTP server.
|
|
analyzerHost: '127.0.0.1',
|
|
// Port that will be used in `server` mode to start HTTP server.
|
|
analyzerPort: 8888,
|
|
// Path to bundle report file that will be generated in `static` mode.
|
|
// Relative to bundles output directory.
|
|
reportFilename: 'report.html',
|
|
// Module sizes to show in report by default.
|
|
// Should be one of `stat`, `parsed` or `gzip`.
|
|
// See "Definitions" section for more information.
|
|
defaultSizes: 'parsed',
|
|
// Automatically open report in default browser
|
|
openAnalyzer: true,
|
|
// If `true`, Webpack Stats JSON file will be generated in bundles output directory
|
|
generateStatsFile: false,
|
|
// Name of Webpack Stats JSON file that will be generated if `generateStatsFile` is `true`.
|
|
// Relative to bundles output directory.
|
|
statsFilename: 'stats.json',
|
|
// Options for `stats.toJson()` method.
|
|
// For example you can exclude sources of your modules from stats file with `source: false` option.
|
|
// See more options here: https://github.com/webpack/webpack/blob/webpack-1/lib/Stats.js#L21
|
|
statsOptions: null,
|
|
// Log level. Can be 'info', 'warn', 'error' or 'silent'.
|
|
logLevel: 'info'
|
|
})
|
|
]
|
|
}
|
|
|
|
var res = merge([base, config])
|
|
res.plugins = res.plugins.concat([
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: {
|
|
warnings: false
|
|
},
|
|
comments: false
|
|
})
|
|
])
|
|
module.exports = res
|