From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- config/webpack.config.js | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 1b851c7..a793358 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -1,4 +1,4 @@ -'use strict'; +// 'use strict'; const fs = require('fs'); const isWsl = require('is-wsl'); @@ -25,7 +25,7 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); -const eslint = require('eslint'); +// const eslint = require('eslint'); const postcssNormalize = require('postcss-normalize'); @@ -173,14 +173,16 @@ pathinfo: isEnvDevelopment, // There will be one main bundle, and one file per asynchronous chunk. // In development, it does not produce real files. + // contenthash => hash filename: isEnvProduction - ? 'static/js/[name].[contenthash:8].js' + ? 'static/js/[name].[hash:8].js' : isEnvDevelopment && 'static/js/bundle.js', // TODO: remove this when upgrading to webpack 5 futureEmitAssets: true, // There are also additional JS chunk files if you use code splitting. + // contenthash => hash chunkFilename: isEnvProduction - ? 'static/js/[name].[contenthash:8].chunk.js' + ? 'static/js/[name].[hash:8].chunk.js' : isEnvDevelopment && 'static/js/[name].chunk.js', // We inferred the "public path" (such as / or /my-project) from homepage. // We use "/" in development. @@ -378,6 +380,7 @@ }, }, ], + // ['import', {libraryName: 'antd', style: true}], ], // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ @@ -402,6 +405,7 @@ require.resolve('babel-preset-react-app/dependencies'), { helpers: true }, ], + // ['import',{libraryName:'antd',style:true}], ], cacheDirectory: true, cacheCompression: isEnvProduction, @@ -563,8 +567,9 @@ new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional - filename: 'static/css/[name].[contenthash:8].css', - chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', + // contenthash => hash + filename: 'static/css/[name].[hash:8].css', + chunkFilename: 'static/css/[name].[hash:8].chunk.css', }), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without -- Gitblit v1.8.0