|
|
@ -11,7 +11,6 @@ const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
|
|
|
|
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
|
|
const eslintFormatter = require('react-dev-utils/eslintFormatter');
|
|
|
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
|
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
|
|
|
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
|
|
|
|
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
|
|
|
|
|
|
|
|
|
|
|
|
const paths = require('./paths');
|
|
|
|
const paths = require('./paths');
|
|
|
|
const getClientEnvironment = require('./env');
|
|
|
|
const getClientEnvironment = require('./env');
|
|
|
|
|
|
|
|
|
|
|
@ -62,9 +61,16 @@ module.exports = {
|
|
|
|
// We generate sourcemaps in production. This is slow but gives good results.
|
|
|
|
// We generate sourcemaps in production. This is slow but gives good results.
|
|
|
|
// You can exclude the *.map files from the build during deployment.
|
|
|
|
// You can exclude the *.map files from the build during deployment.
|
|
|
|
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
|
|
|
|
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
|
|
|
|
devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
|
|
|
|
devtool: false,//测试版
|
|
|
|
// In production, we only want to load the polyfills and the app code.
|
|
|
|
// In production, we only want to load the polyfills and the app code.
|
|
|
|
entry: [require.resolve('./polyfills'), paths.appIndexJs],
|
|
|
|
// entry: [require.resolve('./polyfills'), paths.appIndexJs],
|
|
|
|
|
|
|
|
entry: {
|
|
|
|
|
|
|
|
main:[require.resolve('./polyfills'), paths.appIndexJs],
|
|
|
|
|
|
|
|
vendor: [
|
|
|
|
|
|
|
|
'moment', 'react', 'react-dom','react-router-dom','antd','@icedesign/base','@novnc/novnc','array-flatten','axios',
|
|
|
|
|
|
|
|
'material-ui','monaco-editor','react-monaco-editor', 'echarts',"qs"
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
output: {
|
|
|
|
// The build folder.
|
|
|
|
// The build folder.
|
|
|
|
path: paths.appBuild,
|
|
|
|
path: paths.appBuild,
|
|
|
@ -269,6 +275,30 @@ module.exports = {
|
|
|
|
// In production, it will be an empty string unless you specify "homepage"
|
|
|
|
// In production, it will be an empty string unless you specify "homepage"
|
|
|
|
// in `package.json`, in which case it will be the pathname of that URL.
|
|
|
|
// in `package.json`, in which case it will be the pathname of that URL.
|
|
|
|
new InterpolateHtmlPlugin(env.raw),
|
|
|
|
new InterpolateHtmlPlugin(env.raw),
|
|
|
|
|
|
|
|
new webpack.HashedModuleIdsPlugin(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// new webpack.optimize.ModuleConcatenationPlugin(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
|
|
|
|
async: 'async-vendor',
|
|
|
|
|
|
|
|
deepChildren: true,
|
|
|
|
|
|
|
|
minChunks: (module) => {
|
|
|
|
|
|
|
|
return /node_modules/.test(module.context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new webpack.optimize.CommonsChunkPlugin(
|
|
|
|
|
|
|
|
{names: ["vendors", "webpackAssets",'moment', 'react', 'react-dom','react-router-dom','antd','@icedesign/base','@novnc/novnc','array-flatten','axios',
|
|
|
|
|
|
|
|
'material-ui','monaco-editor','react-monaco-editor', 'echarts',"qs"]}
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
|
|
|
|
name: 'manifest',
|
|
|
|
|
|
|
|
minChunks: (module) => {
|
|
|
|
|
|
|
|
return /node_modules/.test(module.context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
|
|
// Generates an `index.html` file with the <script> injected.
|
|
|
|
// Generates an `index.html` file with the <script> injected.
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
inject: true,
|
|
|
|
inject: true,
|
|
|
@ -317,7 +347,8 @@ module.exports = {
|
|
|
|
cacheDir: '.cache/',
|
|
|
|
cacheDir: '.cache/',
|
|
|
|
uglifyJS:{
|
|
|
|
uglifyJS:{
|
|
|
|
output: {
|
|
|
|
output: {
|
|
|
|
comments: false
|
|
|
|
beautify: true,
|
|
|
|
|
|
|
|
comments: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
warnings: false,
|
|
|
|
warnings: false,
|
|
|
|
compress: {
|
|
|
|
compress: {
|
|
|
@ -383,3 +414,4 @@ module.exports = {
|
|
|
|
child_process: 'empty',
|
|
|
|
child_process: 'empty',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|