mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-30 14:14:17 +00:00
chore(v2): optimize webpack config
This commit is contained in:
parent
637047af2c
commit
1697f9cebb
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue