1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- var utils = require('./utils')
- var webpack = require('webpack')
- var config = require('../config')
- var merge = require('webpack-merge')
- var baseWebpackConfig = require('./webpack.base.conf')
- var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
- var MpvueVendorPlugin = require('webpack-mpvue-vendor-plugin')
- var path = require('path')
- var ExtractTextPlugin = require('extract-text-webpack-plugin')
- var CopyWebpackPlugin = require('copy-webpack-plugin')
- var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
- var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
- module.exports = merge(baseWebpackConfig, {
- module: {
- rules: utils.styleLoaders({
- sourceMap: config.dev.cssSourceMap,
- extract: true
- })
- },
-
-
-
- output: {
- path: config.build.assetsRoot,
-
-
- filename: utils.assetsPath('[name].js'),
- chunkFilename: utils.assetsPath('[id].js')
- },
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': config.dev.env
- }),
-
-
- new ExtractTextPlugin({
-
- filename: utils.assetsPath(`[name].${config.dev.fileExt.style}`)
- }),
-
-
- new OptimizeCSSPlugin({
- cssProcessorOptions: {
- safe: true
- }
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'common/vendor',
- minChunks: function (module, count) {
-
- return (
- module.resource &&
- /\.js$/.test(module.resource) &&
- module.resource.indexOf('node_modules') >= 0
- ) || count > 1
- }
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'common/manifest',
- chunks: ['common/vendor']
- }),
- new MpvueVendorPlugin({
- platform: process.env.PLATFORM
- }),
-
-
- new webpack.NoEmitOnErrorsPlugin(),
-
-
-
-
-
-
- new FriendlyErrorsPlugin(),
- new UglifyJsPlugin({ sourceMap: true })
- ]
- })
|