12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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')
- 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()
- ]
- })
|