mirror of
https://github.com/strapi/strapi.git
synced 2025-10-17 11:08:14 +00:00
Migrate to webpack v5.36
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
2287d2fff1
commit
7b2015c3bd
@ -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,8 +8,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"no tests yet\"",
|
||||
"develop": "webpack serve --config webpack.config.dev.js",
|
||||
"develop:ce": "STRAPI_DISABLE_EE=true webpack serve --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"
|
||||
},
|
||||
"main": "index.js",
|
||||
@ -48,17 +48,15 @@
|
||||
"classnames": "^2.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "5.2.4",
|
||||
"duplicate-package-checker-webpack-plugin": "3.0.0",
|
||||
"execa": "^1.0.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": "2.1.2",
|
||||
"html-webpack-plugin": "4.5.1",
|
||||
"html-webpack-plugin": "5.3.1",
|
||||
"immer": "^8.0.1",
|
||||
"immutable": "^3.8.2",
|
||||
"invariant": "^2.2.4",
|
||||
@ -71,6 +69,7 @@
|
||||
"match-sorter": "^4.0.2",
|
||||
"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",
|
||||
@ -107,7 +106,7 @@
|
||||
"terser-webpack-plugin": "4.2.3",
|
||||
"url-loader": "4.1.1",
|
||||
"video-react": "^0.13.2",
|
||||
"webpack": "4.46.0",
|
||||
"webpack": "5.36.2",
|
||||
"webpack-cli": "4.6.0",
|
||||
"webpack-dev-server": "3.11.2",
|
||||
"webpackbar": "5.0.0-3",
|
||||
|
@ -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: {
|
||||
@ -168,8 +159,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'),
|
||||
@ -195,6 +188,7 @@ module.exports = ({
|
||||
resource.request = resource.request.replace(/ee_else_ce/, path.join(wantedPath));
|
||||
}
|
||||
}),
|
||||
new NodePolyfillPlugin(),
|
||||
...webpackPlugins,
|
||||
],
|
||||
};
|
||||
|
@ -45,7 +45,6 @@ export default {
|
||||
'@babel/preset-env',
|
||||
{
|
||||
modules: false,
|
||||
// loose: true,
|
||||
targets: {
|
||||
browsers: ['Since 2017'],
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user