mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 15:44:59 +00:00
Merge pull request #10219 from strapi/chore/upgrade-webpack-latest
Bump webpack to v5
This commit is contained in:
commit
d2deb95ece
@ -1,7 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
|
||||
"@swc-node/jest": "^1.1.0",
|
||||
"@testing-library/jest-dom": "^5.11.10",
|
||||
"@testing-library/react": "^11.2.6",
|
||||
|
||||
@ -24,13 +24,13 @@ window.strapi = Object.assign(window.strapi || {}, {
|
||||
|
||||
module.exports = {
|
||||
// FIXME:
|
||||
// 'strapi-plugin-documentation': require('../../../../plugins/documentation/admin/src').default,
|
||||
// 'strapi-plugin-users-permissions': require('../../../../plugins/users-permissions/admin/src')
|
||||
// .default,
|
||||
// 'strapi-plugin-content-manager': require('../../../content-manager/admin/src').default,
|
||||
// 'strapi-plugin-content-type-builder': require('../../../content-type-builder/admin/src').default,
|
||||
// 'strapi-plugin-email': require('../../../email/admin/src').default,
|
||||
// 'strapi-plugin-upload': require('../../../upload/admin/src').default,
|
||||
// 'strapi-plugin-graphql': require('../../../../plugins/graphql/admin/src').default,
|
||||
// 'strapi-plugin-i18n': require('../../../../plugins/i18n/admin/src').default,
|
||||
'strapi-plugin-documentation': require('../../../../plugins/documentation/admin/src').default,
|
||||
'strapi-plugin-users-permissions': require('../../../../plugins/users-permissions/admin/src')
|
||||
.default,
|
||||
'strapi-plugin-content-manager': require('../../../content-manager/admin/src').default,
|
||||
'strapi-plugin-content-type-builder': require('../../../content-type-builder/admin/src').default,
|
||||
'strapi-plugin-email': require('../../../email/admin/src').default,
|
||||
'strapi-plugin-upload': require('../../../upload/admin/src').default,
|
||||
'strapi-plugin-graphql': require('../../../../plugins/graphql/admin/src').default,
|
||||
'strapi-plugin-i18n': require('../../../../plugins/i18n/admin/src').default,
|
||||
};
|
||||
|
||||
@ -8,22 +8,23 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"no tests yet\"",
|
||||
"develop": "webpack-dev-server --config webpack.config.dev.js",
|
||||
"develop:ce": "STRAPI_DISABLE_EE=true webpack-dev-server --config webpack.config.dev.js",
|
||||
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js"
|
||||
"develop": "webpack serve --config webpack.config.dev.js --progress profile",
|
||||
"develop:ce": "STRAPI_DISABLE_EE=true webpack serve --config webpack.config.dev.js --progress profile",
|
||||
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js",
|
||||
"analyze:deps": "ANALYZE_DEPS=true webpack serve --config webpack.config.dev.js --progress profile"
|
||||
},
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.13.16",
|
||||
"@babel/plugin-proposal-async-generator-functions": "^7.13.15",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.12.1",
|
||||
"@babel/plugin-transform-runtime": "^7.13.15",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@babel/preset-env": "^7.13.15",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/runtime": "^7.13.17",
|
||||
"@babel/core": "7.14.0",
|
||||
"@babel/plugin-proposal-async-generator-functions": "7.13.15",
|
||||
"@babel/plugin-proposal-class-properties": "7.13.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||
"@babel/plugin-transform-modules-commonjs": "7.14.0",
|
||||
"@babel/plugin-transform-runtime": "7.13.15",
|
||||
"@babel/polyfill": "7.12.1",
|
||||
"@babel/preset-env": "7.14.0",
|
||||
"@babel/preset-react": "7.13.13",
|
||||
"@babel/runtime": "7.14.0",
|
||||
"@buffetjs/core": "3.3.5",
|
||||
"@buffetjs/custom": "3.3.5",
|
||||
"@buffetjs/hooks": "3.3.5",
|
||||
@ -37,39 +38,40 @@
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.3",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
||||
"@fortawesome/react-fontawesome": "^0.1.14",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"@strapi/helper-plugin": "3.6.0",
|
||||
"@strapi/utils": "3.6.0",
|
||||
"axios": "^0.21.1",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-loader": "8.2.2",
|
||||
"babel-plugin-styled-components": "1.12.0",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"bootstrap": "^4.6.0",
|
||||
"chalk": "^4.1.1",
|
||||
"chokidar": "^3.5.1",
|
||||
"classnames": "^2.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^2.1.1",
|
||||
"duplicate-package-checker-webpack-plugin": "^3.0.0",
|
||||
"css-loader": "5.2.4",
|
||||
"execa": "^1.0.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"file-loader": "6.2.0",
|
||||
"font-awesome": "^4.7.0",
|
||||
"formik": "^2.2.6",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"fs-extra": "^9.1.0",
|
||||
"history": "^4.9.0",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"html-loader": "^0.5.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"html-loader": "2.1.2",
|
||||
"html-webpack-plugin": "5.3.1",
|
||||
"immer": "^8.0.1",
|
||||
"immutable": "^3.8.2",
|
||||
"invariant": "^2.2.4",
|
||||
"is-wsl": "^2.0.0",
|
||||
"is-wsl": "2.2.0",
|
||||
"js-cookie": "2.2.1",
|
||||
"jsonwebtoken": "8.5.1",
|
||||
"koa-compose": "4.1.0",
|
||||
"koa-passport": "4.1.4",
|
||||
"lodash": "4.17.21",
|
||||
"match-sorter": "^4.0.2",
|
||||
"mini-css-extract-plugin": "^1.4.0",
|
||||
"mini-css-extract-plugin": "1.6.0",
|
||||
"moment": "^2.29.1",
|
||||
"node-polyfill-webpack-plugin": "1.1.0",
|
||||
"p-map": "4.0.0",
|
||||
"passport-local": "1.0.0",
|
||||
"prop-types": "^15.7.2",
|
||||
@ -101,17 +103,15 @@
|
||||
"sanitize.css": "^4.1.0",
|
||||
"semver": "7.3.5",
|
||||
"sift": "13.5.0",
|
||||
"@strapi/helper-plugin": "3.6.0",
|
||||
"@strapi/utils": "3.6.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"style-loader": "2.0.0",
|
||||
"styled-components": "^5.2.3",
|
||||
"terser-webpack-plugin": "^1.2.3",
|
||||
"url-loader": "^1.1.2",
|
||||
"terser-webpack-plugin": "4.2.3",
|
||||
"url-loader": "4.1.1",
|
||||
"video-react": "^0.13.2",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.2",
|
||||
"webpackbar": "^4.0.0",
|
||||
"webpack": "5.36.2",
|
||||
"webpack-cli": "4.6.0",
|
||||
"webpack-dev-server": "3.11.2",
|
||||
"webpackbar": "5.0.0-3",
|
||||
"yup": "^0.27.0"
|
||||
},
|
||||
"author": {
|
||||
@ -133,6 +133,7 @@
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"gitHead": "231263a3535658bab1e9492c6aaaed8692d62a53",
|
||||
"devDependencies": {
|
||||
"webpack-bundle-analyzer": "4.4.0"
|
||||
"duplicate-dependencies-webpack-plugin": "0.2.0",
|
||||
"webpack-bundle-analyzer": "4.4.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,10 +2,13 @@
|
||||
|
||||
const path = require('path');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const { DuplicateReporterPlugin } = require('duplicate-dependencies-webpack-plugin');
|
||||
|
||||
const webpackConfig = require('./webpack.config.js');
|
||||
|
||||
module.exports = () => {
|
||||
const analyzeBundle = process.env.ANALYZE_BUNDLE;
|
||||
const analyzeDuplicateDependencies = process.env.ANALYZE_DEPS;
|
||||
const entry = path.join(__dirname, 'admin', 'src', 'app.js');
|
||||
const dest = path.join(__dirname, 'build');
|
||||
|
||||
@ -32,6 +35,10 @@ module.exports = () => {
|
||||
config.plugins.push(new BundleAnalyzerPlugin());
|
||||
}
|
||||
|
||||
if (analyzeDuplicateDependencies === 'true') {
|
||||
config.plugins.push(new DuplicateReporterPlugin());
|
||||
}
|
||||
|
||||
return {
|
||||
...config,
|
||||
devServer: {
|
||||
|
||||
@ -2,18 +2,15 @@
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
// Webpack plugins
|
||||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const DuplicatePckgChecker = require('duplicate-package-checker-webpack-plugin');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const WebpackBar = require('webpackbar');
|
||||
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
|
||||
const isWsl = require('is-wsl');
|
||||
const alias = require('./webpack.alias.js');
|
||||
|
||||
// TODO: parametrize
|
||||
// TODO: remove
|
||||
const URLs = {
|
||||
mode: 'host',
|
||||
};
|
||||
@ -31,6 +28,7 @@ module.exports = ({
|
||||
},
|
||||
}) => {
|
||||
const isProduction = env === 'production';
|
||||
|
||||
const webpackPlugins = isProduction
|
||||
? [
|
||||
new webpack.IgnorePlugin({
|
||||
@ -44,26 +42,19 @@ module.exports = ({
|
||||
}),
|
||||
new WebpackBar(),
|
||||
]
|
||||
: [
|
||||
new DuplicatePckgChecker({
|
||||
verbose: true,
|
||||
}),
|
||||
new FriendlyErrorsWebpackPlugin({
|
||||
clearConsole: false,
|
||||
}),
|
||||
];
|
||||
: [];
|
||||
|
||||
return {
|
||||
mode: isProduction ? 'production' : 'development',
|
||||
bail: isProduction ? true : false,
|
||||
devtool: isProduction ? false : 'cheap-module-source-map',
|
||||
devtool: false,
|
||||
entry,
|
||||
output: {
|
||||
path: dest,
|
||||
publicPath: options.publicPath,
|
||||
// Utilize long-term caching by adding content hashes (not compilation hashes)
|
||||
// to compiled assets for production
|
||||
filename: isProduction ? '[name].[contenthash:8].js' : 'bundle.js',
|
||||
filename: isProduction ? '[name].[contenthash:8].js' : '[name].bundle.js',
|
||||
chunkFilename: isProduction ? '[name].[contenthash:8].chunk.js' : '[name].chunk.js',
|
||||
},
|
||||
optimization: {
|
||||
@ -125,23 +116,13 @@ module.exports = ({
|
||||
regenerator: true,
|
||||
},
|
||||
],
|
||||
[require.resolve('babel-plugin-styled-components'), { pure: true }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
// Copied from react-boilerplate https://github.com/react-boilerplate/react-boilerplate
|
||||
{
|
||||
// Preprocess our own .css files
|
||||
// This is the place to add your own loaders (e.g. sass/less etc.)
|
||||
// for a list of loaders, see https://webpack.js.org/loaders/#styling
|
||||
test: /\.css$/,
|
||||
exclude: /node_modules/,
|
||||
use: ['style-loader', 'css-loader'],
|
||||
},
|
||||
{
|
||||
// Preprocess 3rd party .css files located in node_modules
|
||||
test: /\.css$/,
|
||||
include: /node_modules/,
|
||||
test: /\.css$/i,
|
||||
use: ['style-loader', 'css-loader'],
|
||||
},
|
||||
{
|
||||
@ -179,8 +160,10 @@ module.exports = ({
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
template: path.resolve(__dirname, 'index.html'),
|
||||
// FIXME
|
||||
// favicon: path.resolve(__dirname, 'admin/src/favicon.ico'),
|
||||
}),
|
||||
// FIXME: some variables are not needed anymore
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'development'),
|
||||
NODE_ENV: JSON.stringify(isProduction ? 'production' : 'development'),
|
||||
@ -206,6 +189,7 @@ module.exports = ({
|
||||
resource.request = resource.request.replace(/ee_else_ce/, path.join(wantedPath));
|
||||
}
|
||||
}),
|
||||
new NodePolyfillPlugin(),
|
||||
...webpackPlugins,
|
||||
],
|
||||
};
|
||||
|
||||
@ -32,10 +32,12 @@
|
||||
"test": "echo \"no tests yet\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.16",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
"@babel/preset-env": "^7.13.15",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/core": "7.14.0",
|
||||
"@babel/plugin-proposal-class-properties": "7.13.0",
|
||||
"@babel/plugin-transform-runtime": "7.13.15",
|
||||
"@babel/preset-env": "7.14.0",
|
||||
"@babel/preset-react": "7.13.13",
|
||||
"@babel/runtime": "7.14.0",
|
||||
"@rollup/plugin-babel": "5.3.0",
|
||||
"@rollup/plugin-commonjs": "18.0.0",
|
||||
"@rollup/plugin-node-resolve": "11.2.1",
|
||||
@ -52,8 +54,6 @@
|
||||
"rollup-plugin-svg": "2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-runtime": "7.13.15",
|
||||
"@babel/runtime": "7.14.0",
|
||||
"@buffetjs/core": "3.3.5",
|
||||
"@buffetjs/custom": "3.3.5",
|
||||
"@buffetjs/hooks": "3.3.5",
|
||||
@ -66,6 +66,7 @@
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
||||
"@fortawesome/react-fontawesome": "^0.1.14",
|
||||
"@rollup/plugin-image": "2.0.6",
|
||||
"babel-plugin-styled-components": "1.12.0",
|
||||
"bootstrap": "^4.6.0",
|
||||
"classnames": "^2.3.1",
|
||||
"immutable": "^3.8.2",
|
||||
|
||||
@ -45,7 +45,6 @@ export default {
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: false,
|
||||
// loose: true,
|
||||
targets: {
|
||||
browsers: ['Since 2017'],
|
||||
},
|
||||
@ -54,7 +53,11 @@ export default {
|
||||
'@babel/preset-react',
|
||||
],
|
||||
babelHelpers: 'runtime',
|
||||
plugins: ['@babel/plugin-transform-runtime', '@babel/plugin-proposal-class-properties'],
|
||||
plugins: [
|
||||
'@babel/plugin-transform-runtime',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
['babel-plugin-styled-components', { pure: true }],
|
||||
],
|
||||
exclude: 'node_modules/**',
|
||||
}),
|
||||
commonjs(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user