Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove experimental rollup pass #20007

Merged
merged 3 commits into from Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -201,7 +201,6 @@
"regenerator-runtime": "0.13.7",
"resolve-url-loader": "3.1.2",
"rimraf": "3.0.2",
"rollup": "2.38.5",
"rxjs": "6.6.3",
"sass": "1.32.6",
"sass-loader": "10.1.1",
Expand Down
5 changes: 0 additions & 5 deletions packages/angular/cli/lib/config/schema.json
Expand Up @@ -1018,11 +1018,6 @@
"use-credentials"
]
},
"experimentalRollupPass": {
"type": "boolean",
"description": "Concatenate modules with Rollup before bundling them with Webpack.",
"default": false
},
"allowedCommonJsDependencies": {
"description": "A list of CommonJS packages that are allowed to be used without a build time warning.",
"type": "array",
Expand Down
1 change: 0 additions & 1 deletion packages/angular_devkit/build_angular/BUILD.bazel
Expand Up @@ -175,7 +175,6 @@ ts_library(
"@npm//regenerator-runtime",
"@npm//resolve-url-loader",
"@npm//rimraf",
"@npm//rollup",
"@npm//rxjs",
"@npm//sass",
"@npm//sass-loader",
Expand Down
1 change: 0 additions & 1 deletion packages/angular_devkit/build_angular/package.json
Expand Up @@ -55,7 +55,6 @@
"regenerator-runtime": "0.13.7",
"resolve-url-loader": "3.1.2",
"rimraf": "3.0.2",
"rollup": "2.38.5",
"rxjs": "6.6.3",
"sass": "1.32.6",
"sass-loader": "10.1.1",
Expand Down
102 changes: 0 additions & 102 deletions packages/angular_devkit/build_angular/src/browser/specs/rollup_spec.ts

This file was deleted.

Expand Up @@ -76,7 +76,6 @@ export interface BuildOptions {
platform?: 'browser' | 'server';
fileReplacements: NormalizedFileReplacement[];

experimentalRollupPass?: boolean;
allowedCommonJsDependencies?: string[];

differentialLoadingNeeded?: boolean;
Expand Down
Expand Up @@ -44,18 +44,6 @@ export async function generateWebpackConfig(
throw new Error(`The 'buildOptimizer' option cannot be used without 'aot'.`);
}

// Ensure Rollup Concatenation is only used with compatible options.
if (options.experimentalRollupPass) {
if (!options.aot) {
throw new Error(`The 'experimentalRollupPass' option cannot be used without 'aot'.`);
}

if (options.vendorChunk || options.commonChunk || options.namedChunks) {
throw new Error(`The 'experimentalRollupPass' option cannot be used with the`
+ `'vendorChunk', 'commonChunk', 'namedChunks' options set to true.`);
}
}

const tsConfigPath = path.resolve(workspaceRoot, options.tsConfig);
const tsConfig = readTsconfig(tsConfigPath);

Expand Down
Expand Up @@ -12,7 +12,6 @@ import {
import * as CopyWebpackPlugin from 'copy-webpack-plugin';
import { existsSync } from 'fs';
import * as path from 'path';
import { RollupOptions } from 'rollup';
import { ScriptTarget } from 'typescript';
import {
Compiler,
Expand Down Expand Up @@ -43,7 +42,6 @@ import {
NamedLazyChunksPlugin,
OptimizeCssWebpackPlugin,
ScriptsWebpackPlugin,
WebpackRollupLoader,
} from '../plugins';
import { getEsVersionForFileName, getOutputHashFormat, getWatchOptions, normalizeExtraEntryPoints } from '../utils/helpers';
import { IGNORE_WARNINGS } from '../utils/stats';
Expand Down Expand Up @@ -82,49 +80,6 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
if (buildOptions.main) {
const mainPath = path.resolve(root, buildOptions.main);
entryPoints['main'] = [mainPath];

if (buildOptions.experimentalRollupPass) {
// NOTE: the following are known problems with experimentalRollupPass
// - vendorChunk, commonChunk, namedChunks: these won't work, because by the time webpack
// sees the chunks, the context of where they came from is lost.
// - webWorkerTsConfig: workers must be imported via a root relative path (e.g.
// `app/search/search.worker`) instead of a relative path (`/search.worker`) because
// of the same reason as above.
// - loadChildren string syntax: doesn't work because rollup cannot follow the imports.

// Rollup options, except entry module, which is automatically inferred.
const rollupOptions: RollupOptions = {};

// Add rollup plugins/rules.
extraRules.push({
test: mainPath,
// Ensure rollup loader executes after other loaders.
enforce: 'post',
use: [{
loader: WebpackRollupLoader,
options: rollupOptions,
}],
});

// Rollup bundles will include the dynamic System.import that was inside Angular and webpack
// will emit warnings because it can't resolve it. We just ignore it.
// TODO: maybe use https://webpack.js.org/configuration/stats/#statswarningsfilter instead.

// Ignore all "Critical dependency: the request of a dependency is an expression" warnings.
extraPlugins.push(new ContextReplacementPlugin(/./));
// Ignore "System.import() is deprecated" warnings for the main file and js files.
// Might still get them if @angular/core gets split into a lazy module.
extraRules.push({
test: mainPath,
enforce: 'post',
parser: { system: true },
});
extraRules.push({
test: /\.js$/,
enforce: 'post',
parser: { system: true },
});
}
}

const differentialLoadingMode = buildOptions.differentialLoadingNeeded && !buildOptions.watch;
Expand Down Expand Up @@ -408,9 +363,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
output: {
ecma: terserEcma,
// For differential loading, this is handled in the bundle processing.
// This should also work with just true but the experimental rollup support breaks without this check.
ascii_only: !differentialLoadingMode,
// default behavior (undefined value) is to keep only important comments (licenses, etc.)
// Default behavior (undefined value) is to keep only important comments (licenses, etc.)
comments: !buildOptions.extractLicenses && undefined,
webkit: true,
beautify: shouldBeautify,
Expand Down
Expand Up @@ -42,11 +42,6 @@ function canUseIvyPlugin(wco: WebpackConfigOptions): boolean {
return false;
}

// This pass relies on internals of the original plugin
if (wco.buildOptions.experimentalRollupPass) {
return false;
}

return true;
}

Expand Down
Expand Up @@ -19,6 +19,3 @@ export {
default as PostcssCliResources,
PostcssCliResourcesOptions,
} from './postcss-cli-resources';

import { join } from 'path';
export const WebpackRollupLoader = require.resolve(join(__dirname, 'webpack-rollup-loader'));