chore(v2): optimize webpack config

This commit is contained in:
endiliey 2019-05-06 13:35:57 +08:00
parent 637047af2c
commit 1697f9cebb
2 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,7 @@
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');
const fs = require('fs-extra');
const isWsl = require('is-wsl');
const {getBabelLoader, getCacheLoader, getStyleLoaders} = require('./utils');
@ -33,6 +34,10 @@ module.exports = function createBaseConfig(props, isServer) {
chunkFilename: isProd ? '[name].[chunkhash].js' : '[name].js',
publicPath: baseUrl,
},
// Don't throw warning when asset created is over 250kb
performance: {
hints: false,
},
devtool: !isProd && 'cheap-module-eval-source-map',
resolve: {
symlinks: true,
@ -46,9 +51,7 @@ module.exports = function createBaseConfig(props, isServer) {
},
modules: [
'node_modules',
path.resolve(__dirname, '../../node_modules'),
path.resolve(siteDir, 'node_modules'),
path.resolve(process.cwd(), 'node_modules'),
path.resolve(fs.realpathSync(process.cwd()), 'node_modules'),
],
},
optimization: {

View File

@ -59,7 +59,6 @@ function getBabelLoader(isServer, babelOptions) {
presets: ['@babel/env', '@babel/react'],
plugins: [
isServer ? 'dynamic-import-node' : '@babel/syntax-dynamic-import',
'react-loadable/babel',
],
},
babelOptions,