-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
31 lines (29 loc) · 1.34 KB
/
webpack.config.js
File metadata and controls
31 lines (29 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Custom Webpack Configuration for the 'plugin' Remote.
*
* This configuration is necessary to fix a Webpack 5+ module parsing error
* when using the Native Federation builder in certain Angular CLI versions.
* The error occurs because the Native Federation runtime files (which are
* pure ES modules) are being incorrectly processed by Angular's default loaders.
* * NOTE: The configuration is now exported as a function to ensure it's properly
* loaded and merged by the Native Federation builder.
*/
module.exports = (config, options) => {
console.log("--- DEBUG: Custom plugin/webpack.config.js is being loaded (Function Export) ---");
// Add the specific rule to treat Native Federation runtime files as pure JavaScript modules.
config.module.rules.push(
{
// Target JavaScript files inside the problematic Native Federation and SoftArc runtime packages.
test: /\.js$/,
include: [
/node_modules[\\/]@angular-architects[\\/]native-federation/,
/node_modules[\\/]@softarc[\\/]native-federation-runtime/
],
// Tell Webpack to process these files as plain JavaScript modules,
// which prevents the build pipeline from incorrectly attempting to parse
// their ES module syntax (`import`/`export`) as a different module type.
type: 'javascript/auto'
}
);
return config;
};