final touches webpack config

This commit is contained in:
Joseph HENRY 2025-11-19 15:25:44 +01:00
parent d95cc7eacf
commit 928dab41e8

View File

@ -12,6 +12,9 @@ interface FindReplacePluginOptions {
replace: { from: RegExp; to: string }[]; replace: { from: RegExp; to: string }[];
} }
/**
* Simple find and replace in assets plugin for Webpack
*/
class FindReplacePlugin { class FindReplacePlugin {
options: FindReplacePluginOptions; options: FindReplacePluginOptions;
@ -65,14 +68,12 @@ class FindReplacePlugin {
} }
const babelRule: RuleSetRule = { const babelRule: RuleSetRule = {
test: /\.(ts|js)$/, test: /\.(ts|js|mjs)$/,
// https://webpack.js.org/loaders/babel-loader/#exclude-libraries-that-should-not-be-transpiled // https://webpack.js.org/loaders/babel-loader/#exclude-libraries-that-should-not-be-transpiled
exclude: /node_modules/, exclude: [
// exclude: [ // \\ for Windows, / for macOS and Linux
// // \\ for Windows, / for macOS and Linux /node_modules[\\/]core-js/,
// /node_modules[\\/]core-js/, ],
// /node_modules[\\/]webpack[\\/]buildin/,
// ],
use: { use: {
loader: "babel-loader", loader: "babel-loader",
options: { options: {
@ -147,7 +148,7 @@ const config: Configuration = {
*/ */
{ from: /\[\^\\s\(\/\]/g, to: "[^\\s(\\/]" }, { from: /\[\^\\s\(\/\]/g, to: "[^\\s(\\/]" },
{ from: /\[\\w\.\/\]/g, to: "[\\w.\\/]" }, { from: /\[\\w\.\/\]/g, to: "[\\w.\\/]" },
// [a-z_+-\/] { from: /\[a-z_\+-\/\]/g, to: "[a-z_+-\\/]" },
], ],
}), }),
], ],