Files
2026-07-13 12:38:36 +08:00

74 lines
2.1 KiB
JavaScript

module.exports = () => {
if (global.NX_GRAPH_CREATION === undefined) {
const {
NxModuleFederationPlugin,
NxModuleFederationDevServerPlugin,
} = require('@nx/module-federation/angular');
const { createConfig } = require('@nx/angular-rspack');
const mfConfig = require('./module-federation.config');
const config = createConfig(
{
options: {
root: __dirname,
outputPath: {
base: './dist',
browser: './browser',
},
index: './src/index.html',
browser: './src/main.ts',
tsConfig: './tsconfig.app.json',
polyfills: ['zone.js'],
assets: [{ glob: '**/*', input: 'public' }],
statsJson: true,
styles: ['./src/styles.scss'],
},
rspackConfigOverrides: {
plugins: [
new NxModuleFederationPlugin(
{ config: mfConfig },
{
dts: false,
}
),
new NxModuleFederationDevServerPlugin({ config: mfConfig }),
],
},
},
{
development: {
options: {
extractLicenses: false,
optimization: false,
outputHashing: 'none',
namedChunks: true,
vendorChunk: true,
devServer: {
/**
* These values MUST be set to ensure that the webSocketSettings within the devServer config is configured to
* only listen for updates to this specific project. Otherwise, a live reload loop could be created.
*/
publicHost: 'localhost:4201',
port: 4201,
},
},
},
production: {
options: {
extractLicenses: false,
outputHashing: 'all',
optimization: {
scripts: true,
styles: {
minify: false,
inlineCritical: true,
},
},
},
},
}
);
return config;
}
return {};
};