Skip to content

Commit

Permalink
webpack: Remove outdated config
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Mar 26, 2024
1 parent 44113ab commit 749ae46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 46 deletions.
53 changes: 8 additions & 45 deletions invenio_assets/assets/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

const BundleTracker = require("webpack-bundle-tracker");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const ESLintPlugin = require("eslint-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
Expand All @@ -19,7 +18,7 @@ const TerserPlugin = require("terser-webpack-plugin");
const config = require("./config");
const path = require("path");
const webpack = require("webpack");

const devMode = process.env.NODE_ENV !== "production";
// Load aliases from config and resolve their full path
let aliases = {};
if (config.aliases) {
Expand Down Expand Up @@ -61,42 +60,17 @@ var webpackConfig = {
filename: "js/[name].[chunkhash].js",
chunkFilename: "js/[id].[chunkhash].js",
publicPath: config.build.assetsURL,
clean: true,
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
parse: {
// We want terser to parse ecma 8 code. However, we don't want it
// to apply any minification steps that turns valid ecma 5 code
// into invalid ecma 5 code. This is why the 'compress' and 'output'
// sections only apply transformations that are ecma 5 safe
// https://github.com/facebook/create-react-app/pull/4234
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/facebook/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false,
// Disabled because of an issue with Terser breaking valid code:
// https://github.com/facebook/create-react-app/issues/5250
// Pending further investigation:
// https://github.com/terser-js/terser/issues/120
inline: 2,
},
mangle: {
safari10: true,
},
compress: true,
mangle: true,
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
},
},
}),
Expand Down Expand Up @@ -189,8 +163,7 @@ var webpackConfig = {
},
],
},
devtool:
process.env.NODE_ENV === "production" ? "source-map" : "inline-source-map",
devtool: devMode ? "inline-source-map" : "source-map",
plugins: [
new ESLintPlugin({
emitWarning: true,
Expand All @@ -208,13 +181,6 @@ var webpackConfig = {
filename: "css/[name].[contenthash].css",
chunkFilename: "css/[name].[contenthash].css",
}),
// Removes the dist folder before each run.
new CleanWebpackPlugin({
dry: false,
verbose: false,
dangerouslyAllowCleanPatternsOutsideProject: true,
cleanStaleWebpackAssets: process.env.NODE_ENV === "production", // keep stale assets in dev because of OS issues
}),
// Copying relevant CSS files as TinyMCE tries to import css files from the dist/js folder of static files
new CopyWebpackPlugin({
patterns: [
Expand Down Expand Up @@ -250,9 +216,10 @@ var webpackConfig = {
snapshot: {
managedPaths: [],
},
watch: devMode,
watchOptions: {
followSymlinks: true,
},
},
cache: false,
};

Expand All @@ -262,9 +229,5 @@ if (process.env.npm_config_report) {
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
}

if (process.env.NODE_ENV === "development") {
const LiveReloadPlugin = require("webpack-livereload-plugin");
webpackConfig.plugins.push(new LiveReloadPlugin());
}

module.exports = webpackConfig;
1 change: 0 additions & 1 deletion invenio_assets/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"autoprefixer": "^10.4.0",
"babel-loader": "^9.0.0",
"chalk": "^5.0.0",
"clean-webpack-plugin": "^4.0.0",
"css-loader": "^6.0.0",
"css-minimizer-webpack-plugin": "^4.2.0",
"eslint-config-react-app": "^7.0.1",
Expand Down

0 comments on commit 749ae46

Please sign in to comment.