Skip to content

Commit

Permalink
feat(angular): enable minimization for MFEs (nrwl#8135)
Browse files Browse the repository at this point in the history
* feat(angular): enable minimization for MFEs

* fix(angular): test snapshots
  • Loading branch information
Coly010 authored Dec 13, 2021
1 parent 7ca6b29 commit 5339e99
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -94,7 +93,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -157,7 +155,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -219,7 +216,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function updateTsConfigOptions(host: Tree, options: NormalizedSchema) {
compilerOptions: {
...json.compilerOptions,
outDir: `${offsetFromRoot(options.appProjectRoot)}dist/out-tsc`,
target: 'ES2017',
},
exclude: [
...new Set([...(json.exclude || []), '**/*.test.ts', '**/*.spec.ts']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -124,7 +123,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -187,7 +185,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down Expand Up @@ -249,7 +246,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = {
},
optimization: {
runtimeChunk: false,
minimize: false,
},
experiments: {
outputModule: true
Expand Down
1 change: 1 addition & 0 deletions packages/angular/src/generators/setup-mfe/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export * from './change-build-target';
export * from './fix-bootstrap';
export * from './generate-config';
export * from './get-remotes-with-ports';
export * from './set-tsconfig-target';
export * from './setup-serve-target';
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Tree } from '@nrwl/devkit';
import type { Schema } from '../schema';

import {
updateJson,
readProjectConfiguration,
joinPathFragments,
} from '@nrwl/devkit';

export function updateTsConfigTarget(tree: Tree, schema: Schema) {
const { root } = readProjectConfiguration(tree, schema.appName);
// tsconfig.app.json
updateJson(tree, joinPathFragments(root, `tsconfig.app.json`), (json) => ({
...json,
compilerOptions: {
...json.compilerOptions,
target: 'ES2020',
},
}));
}
2 changes: 2 additions & 0 deletions packages/angular/src/generators/setup-mfe/setup-mfe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
generateWebpackConfig,
getRemotesWithPorts,
setupServeTarget,
updateTsConfigTarget,
} from './lib';
import { angularArchitectsModuleFederationPluginVersion } from '../../utils/versions';

Expand All @@ -30,6 +31,7 @@ export async function setupMfe(host: Tree, options: Schema) {
addEntryModule(host, options, projectConfig.root);
addImplicitDeps(host, options);
changeBuildTarget(host, options);
updateTsConfigTarget(host, options);
setupServeTarget(host, options);

fixBootstrap(host, projectConfig.root);
Expand Down

0 comments on commit 5339e99

Please sign in to comment.