Skip to content

Commit fb2d7ee

Browse files
alan-agius4clydin
authored andcommitted
refactor(@angular-devkit/build-angular): remove experimental rollup pass
The experimental rollup pass has significant issues with the new Ivy webpack plugin. It also, didn't produce as well as we hoped in real world scenarios infact in many cases this caused build to fail. REAKING CHANGE: The experimental rollup pass `--experimental-rollup-pass` option has been removed. Closes #15836
1 parent 5c3d9cd commit fb2d7ee

File tree

13 files changed

+2
-395
lines changed

13 files changed

+2
-395
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@
201201
"regenerator-runtime": "0.13.7",
202202
"resolve-url-loader": "3.1.2",
203203
"rimraf": "3.0.2",
204-
"rollup": "2.38.5",
205204
"rxjs": "6.6.3",
206205
"sass": "1.32.6",
207206
"sass-loader": "10.1.1",

packages/angular/cli/lib/config/schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,6 @@
10181018
"use-credentials"
10191019
]
10201020
},
1021-
"experimentalRollupPass": {
1022-
"type": "boolean",
1023-
"description": "Concatenate modules with Rollup before bundling them with Webpack.",
1024-
"default": false
1025-
},
10261021
"allowedCommonJsDependencies": {
10271022
"description": "A list of CommonJS packages that are allowed to be used without a build time warning.",
10281023
"type": "array",

packages/angular_devkit/build_angular/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ ts_library(
175175
"@npm//regenerator-runtime",
176176
"@npm//resolve-url-loader",
177177
"@npm//rimraf",
178-
"@npm//rollup",
179178
"@npm//rxjs",
180179
"@npm//sass",
181180
"@npm//sass-loader",

packages/angular_devkit/build_angular/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"regenerator-runtime": "0.13.7",
5656
"resolve-url-loader": "3.1.2",
5757
"rimraf": "3.0.2",
58-
"rollup": "2.38.5",
5958
"rxjs": "6.6.3",
6059
"sass": "1.32.6",
6160
"sass-loader": "10.1.1",

packages/angular_devkit/build_angular/src/browser/specs/rollup_spec.ts

Lines changed: 0 additions & 102 deletions
This file was deleted.

packages/angular_devkit/build_angular/src/utils/build-options.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export interface BuildOptions {
7676
platform?: 'browser' | 'server';
7777
fileReplacements: NormalizedFileReplacement[];
7878

79-
experimentalRollupPass?: boolean;
8079
allowedCommonJsDependencies?: string[];
8180

8281
differentialLoadingNeeded?: boolean;

packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ export async function generateWebpackConfig(
4444
throw new Error(`The 'buildOptimizer' option cannot be used without 'aot'.`);
4545
}
4646

47-
// Ensure Rollup Concatenation is only used with compatible options.
48-
if (options.experimentalRollupPass) {
49-
if (!options.aot) {
50-
throw new Error(`The 'experimentalRollupPass' option cannot be used without 'aot'.`);
51-
}
52-
53-
if (options.vendorChunk || options.commonChunk || options.namedChunks) {
54-
throw new Error(`The 'experimentalRollupPass' option cannot be used with the`
55-
+ `'vendorChunk', 'commonChunk', 'namedChunks' options set to true.`);
56-
}
57-
}
58-
5947
const tsConfigPath = path.resolve(workspaceRoot, options.tsConfig);
6048
const tsConfig = readTsconfig(tsConfigPath);
6149

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
import * as CopyWebpackPlugin from 'copy-webpack-plugin';
1313
import { existsSync } from 'fs';
1414
import * as path from 'path';
15-
import { RollupOptions } from 'rollup';
1615
import { ScriptTarget } from 'typescript';
1716
import {
1817
Compiler,
@@ -43,7 +42,6 @@ import {
4342
NamedLazyChunksPlugin,
4443
OptimizeCssWebpackPlugin,
4544
ScriptsWebpackPlugin,
46-
WebpackRollupLoader,
4745
} from '../plugins';
4846
import { getEsVersionForFileName, getOutputHashFormat, getWatchOptions, normalizeExtraEntryPoints } from '../utils/helpers';
4947
import { IGNORE_WARNINGS } from '../utils/stats';
@@ -82,49 +80,6 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
8280
if (buildOptions.main) {
8381
const mainPath = path.resolve(root, buildOptions.main);
8482
entryPoints['main'] = [mainPath];
85-
86-
if (buildOptions.experimentalRollupPass) {
87-
// NOTE: the following are known problems with experimentalRollupPass
88-
// - vendorChunk, commonChunk, namedChunks: these won't work, because by the time webpack
89-
// sees the chunks, the context of where they came from is lost.
90-
// - webWorkerTsConfig: workers must be imported via a root relative path (e.g.
91-
// `app/search/search.worker`) instead of a relative path (`/search.worker`) because
92-
// of the same reason as above.
93-
// - loadChildren string syntax: doesn't work because rollup cannot follow the imports.
94-
95-
// Rollup options, except entry module, which is automatically inferred.
96-
const rollupOptions: RollupOptions = {};
97-
98-
// Add rollup plugins/rules.
99-
extraRules.push({
100-
test: mainPath,
101-
// Ensure rollup loader executes after other loaders.
102-
enforce: 'post',
103-
use: [{
104-
loader: WebpackRollupLoader,
105-
options: rollupOptions,
106-
}],
107-
});
108-
109-
// Rollup bundles will include the dynamic System.import that was inside Angular and webpack
110-
// will emit warnings because it can't resolve it. We just ignore it.
111-
// TODO: maybe use https://webpack.js.org/configuration/stats/#statswarningsfilter instead.
112-
113-
// Ignore all "Critical dependency: the request of a dependency is an expression" warnings.
114-
extraPlugins.push(new ContextReplacementPlugin(/./));
115-
// Ignore "System.import() is deprecated" warnings for the main file and js files.
116-
// Might still get them if @angular/core gets split into a lazy module.
117-
extraRules.push({
118-
test: mainPath,
119-
enforce: 'post',
120-
parser: { system: true },
121-
});
122-
extraRules.push({
123-
test: /\.js$/,
124-
enforce: 'post',
125-
parser: { system: true },
126-
});
127-
}
12883
}
12984

13085
const differentialLoadingMode = buildOptions.differentialLoadingNeeded && !buildOptions.watch;
@@ -408,9 +363,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
408363
output: {
409364
ecma: terserEcma,
410365
// For differential loading, this is handled in the bundle processing.
411-
// This should also work with just true but the experimental rollup support breaks without this check.
412366
ascii_only: !differentialLoadingMode,
413-
// default behavior (undefined value) is to keep only important comments (licenses, etc.)
367+
// Default behavior (undefined value) is to keep only important comments (licenses, etc.)
414368
comments: !buildOptions.extractLicenses && undefined,
415369
webkit: true,
416370
beautify: shouldBeautify,

packages/angular_devkit/build_angular/src/webpack/configs/typescript.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ function canUseIvyPlugin(wco: WebpackConfigOptions): boolean {
4242
return false;
4343
}
4444

45-
// This pass relies on internals of the original plugin
46-
if (wco.buildOptions.experimentalRollupPass) {
47-
return false;
48-
}
49-
5045
return true;
5146
}
5247

packages/angular_devkit/build_angular/src/webpack/plugins/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ export {
1919
default as PostcssCliResources,
2020
PostcssCliResourcesOptions,
2121
} from './postcss-cli-resources';
22-
23-
import { join } from 'path';
24-
export const WebpackRollupLoader = require.resolve(join(__dirname, 'webpack-rollup-loader'));

0 commit comments

Comments
 (0)