diff --git a/package-lock.json b/package-lock.json
index 6467f8038366..ea3b7fff48f5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -973,6 +973,11 @@
}
}
},
+ "charenc": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
+ "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
+ },
"chokidar": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
@@ -1691,6 +1696,11 @@
"which": "1.3.0"
}
},
+ "crypt": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
+ "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
+ },
"cryptiles": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
@@ -4534,6 +4544,16 @@
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
"integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw="
},
+ "md5": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
+ "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
+ "requires": {
+ "charenc": "0.0.2",
+ "crypt": "0.0.2",
+ "is-buffer": "1.1.5"
+ }
+ },
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -6574,14 +6594,6 @@
"ajv": "5.2.2"
}
},
- "script-loader": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/script-loader/-/script-loader-0.7.0.tgz",
- "integrity": "sha1-aF3H5waeDe56kmdPDrxbD1W6pew=",
- "requires": {
- "raw-loader": "0.5.1"
- }
- },
"scss-tokenizer": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz",
@@ -7983,6 +7995,58 @@
}
}
},
+ "webpack-concat-plugin": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/webpack-concat-plugin/-/webpack-concat-plugin-1.4.0.tgz",
+ "integrity": "sha512-Ym9Qm5Sw9oXJYChNJk09I/yaXDaV3UDxsa07wcCvILzIeSJTnSUZjhS4y2YkULzgE8VHOv9X04KtlJPZGwXqMg==",
+ "requires": {
+ "md5": "2.2.1",
+ "uglify-js": "2.8.29"
+ },
+ "dependencies": {
+ "camelcase": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
+ "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk="
+ },
+ "cliui": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
+ "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
+ "requires": {
+ "center-align": "0.1.3",
+ "right-align": "0.1.3",
+ "wordwrap": "0.0.2"
+ }
+ },
+ "uglify-js": {
+ "version": "2.8.29",
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
+ "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=",
+ "requires": {
+ "source-map": "0.5.6",
+ "uglify-to-browserify": "1.0.2",
+ "yargs": "3.10.0"
+ }
+ },
+ "wordwrap": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
+ "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8="
+ },
+ "yargs": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
+ "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
+ "requires": {
+ "camelcase": "1.2.1",
+ "cliui": "2.1.0",
+ "decamelize": "1.2.0",
+ "window-size": "0.1.0"
+ }
+ }
+ }
+ },
"webpack-dev-middleware": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.0.tgz",
diff --git a/package.json b/package.json
index 236f840d402b..2246599f527a 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,6 @@
"rsvp": "^3.0.17",
"rxjs": "^5.4.2",
"sass-loader": "^6.0.3",
- "script-loader": "^0.7.0",
"semver": "^5.3.0",
"silent-error": "^1.0.0",
"source-map": "^0.5.6",
@@ -95,6 +94,7 @@
"typescript": "~2.4.2",
"url-loader": "^0.5.7",
"webpack": "~3.4.1",
+ "webpack-concat-plugin": "1.4.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.5.1",
"webpack-merge": "^4.1.0",
diff --git a/packages/@angular/cli/models/webpack-configs/common.ts b/packages/@angular/cli/models/webpack-configs/common.ts
index 7aed537e008d..f211a79ed41e 100644
--- a/packages/@angular/cli/models/webpack-configs/common.ts
+++ b/packages/@angular/cli/models/webpack-configs/common.ts
@@ -2,9 +2,11 @@ import * as webpack from 'webpack';
import * as path from 'path';
import { GlobCopyWebpackPlugin } from '../../plugins/glob-copy-webpack-plugin';
import { NamedLazyChunksWebpackPlugin } from '../../plugins/named-lazy-chunks-webpack-plugin';
+import { InsertConcatAssetsWebpackPlugin } from '../../plugins/insert-concat-assets-webpack-plugin';
import { extraEntryParser, getOutputHashFormat } from './utils';
import { WebpackConfigOptions } from '../webpack-config';
+const ConcatPlugin = require('webpack-concat-plugin');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
@@ -15,7 +17,6 @@ const CircularDependencyPlugin = require('circular-dependency-plugin');
*
* require('source-map-loader')
* require('raw-loader')
- * require('script-loader')
* require('url-loader')
* require('file-loader')
* require('@angular-devkit/build-optimizer')
@@ -45,12 +46,40 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
// process global scripts
if (appConfig.scripts.length > 0) {
const globalScripts = extraEntryParser(appConfig.scripts, appRoot, 'scripts');
-
- // add entry points and lazy chunks
- globalScripts.forEach(script => {
- let scriptPath = `script-loader!${script.path}`;
- entryPoints[script.entry] = (entryPoints[script.entry] || []).concat(scriptPath);
+ const globalScriptsByEntry = globalScripts
+ .reduce((prev: { entry: string, paths: string[], lazy: boolean }[], curr) => {
+
+ let existingEntry = prev.find((el) => el.entry === curr.entry);
+ if (existingEntry) {
+ existingEntry.paths.push(curr.path);
+ // All entries have to be lazy for the bundle to be lazy.
+ existingEntry.lazy = existingEntry.lazy && curr.lazy;
+ } else {
+ prev.push({ entry: curr.entry, paths: [curr.path], lazy: curr.lazy });
+ }
+ return prev;
+ }, []);
+
+
+ // Add a new asset for each entry.
+ globalScriptsByEntry.forEach((script) => {
+ const hash = hashFormat.chunk !== '' && !script.lazy ? '.[hash]' : '';
+ extraPlugins.push(new ConcatPlugin({
+ uglify: buildOptions.target === 'production' ? { sourceMapIncludeSources: true } : false,
+ sourceMap: buildOptions.sourcemaps,
+ name: script.entry,
+ // Lazy scripts don't get a hash, otherwise they can't be loaded by name.
+ fileName: `[name]${script.lazy ? '' : hash}.bundle.js`,
+ filesToConcat: script.paths
+ }));
});
+
+ // Insert all the assets created by ConcatPlugin in the right place in index.html.
+ extraPlugins.push(new InsertConcatAssetsWebpackPlugin(
+ globalScriptsByEntry
+ .filter((el) => !el.lazy)
+ .map((el) => el.entry)
+ ));
}
// process asset entries
diff --git a/packages/@angular/cli/models/webpack-configs/utils.ts b/packages/@angular/cli/models/webpack-configs/utils.ts
index e44e4d34b00b..e09592d6e127 100644
--- a/packages/@angular/cli/models/webpack-configs/utils.ts
+++ b/packages/@angular/cli/models/webpack-configs/utils.ts
@@ -73,15 +73,16 @@ export interface HashFormat {
chunk: string;
extract: string;
file: string;
+ script: string;
}
export function getOutputHashFormat(option: string, length = 20): HashFormat {
/* tslint:disable:max-line-length */
const hashFormats: { [option: string]: HashFormat } = {
- none: { chunk: '', extract: '', file: '' },
- media: { chunk: '', extract: '', file: `.[hash:${length}]` },
- bundles: { chunk: `.[chunkhash:${length}]`, extract: `.[contenthash:${length}]`, file: '' },
- all: { chunk: `.[chunkhash:${length}]`, extract: `.[contenthash:${length}]`, file: `.[hash:${length}]` },
+ none: { chunk: '', extract: '', file: '' , script: '' },
+ media: { chunk: '', extract: '', file: `.[hash:${length}]`, script: '' },
+ bundles: { chunk: `.[chunkhash:${length}]`, extract: `.[contenthash:${length}]`, file: '' , script: '.[hash]' },
+ all: { chunk: `.[chunkhash:${length}]`, extract: `.[contenthash:${length}]`, file: `.[hash:${length}]`, script: '.[hash]' },
};
/* tslint:enable:max-line-length */
return hashFormats[option] || hashFormats['none'];
diff --git a/packages/@angular/cli/package.json b/packages/@angular/cli/package.json
index 3ca799f8d908..5da3c059c8d7 100644
--- a/packages/@angular/cli/package.json
+++ b/packages/@angular/cli/package.json
@@ -68,7 +68,6 @@
"rsvp": "^3.0.17",
"rxjs": "^5.4.2",
"sass-loader": "^6.0.3",
- "script-loader": "^0.7.0",
"semver": "^5.1.0",
"silent-error": "^1.0.0",
"source-map-loader": "^0.2.0",
@@ -80,6 +79,7 @@
"typescript": ">=2.0.0 <2.5.0",
"url-loader": "^0.5.7",
"webpack": "~3.4.1",
+ "webpack-concat-plugin": "1.4.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.5.1",
"webpack-merge": "^4.1.0",
diff --git a/packages/@angular/cli/plugins/insert-concat-assets-webpack-plugin.ts b/packages/@angular/cli/plugins/insert-concat-assets-webpack-plugin.ts
new file mode 100644
index 000000000000..870d9c7081c4
--- /dev/null
+++ b/packages/@angular/cli/plugins/insert-concat-assets-webpack-plugin.ts
@@ -0,0 +1,45 @@
+// Add assets from `ConcatPlugin` to index.html.
+
+export class InsertConcatAssetsWebpackPlugin {
+ // Priority list of where to insert asset.
+ private insertAfter = [
+ /polyfills(\.[0-9a-f]{20})?\.bundle\.js/,
+ /inline(\.[0-9a-f]{20})?\.bundle\.js/,
+ ];
+
+ constructor(private entryNames: string[]) { }
+
+ apply(compiler: any): void {
+ compiler.plugin('compilation', (compilation: any) => {
+ compilation.plugin('html-webpack-plugin-before-html-generation',
+ (htmlPluginData: any, callback: any) => {
+
+ const fileNames = this.entryNames.map((entryName) => {
+ const fileName = htmlPluginData.assets.webpackConcat
+ && htmlPluginData.assets.webpackConcat[entryName];
+
+ if (!fileName) {
+ // Something went wrong and the asset was not correctly added.
+ throw new Error(`Cannot find file for ${entryName} script.`);
+ }
+
+ return fileName;
+ });
+
+ let insertAt = 0;
+
+ // TODO: try to figure out if there are duplicate bundle names when adding and throw
+ for (let el of this.insertAfter) {
+ const jsIdx = htmlPluginData.assets.js.findIndex((js: string) => js.match(el));
+ if (jsIdx !== -1) {
+ insertAt = jsIdx + 1;
+ break;
+ }
+ }
+
+ htmlPluginData.assets.js.splice(insertAt, 0, ...fileNames);
+ callback(null, htmlPluginData);
+ });
+ });
+ }
+}
diff --git a/packages/@angular/cli/plugins/webpack.js b/packages/@angular/cli/plugins/webpack.js
index c2636e70496d..6f15043e2c4b 100644
--- a/packages/@angular/cli/plugins/webpack.js
+++ b/packages/@angular/cli/plugins/webpack.js
@@ -8,5 +8,7 @@ module.exports = {
require('../plugins/suppress-entry-chunks-webpack-plugin')
.SuppressExtractedTextChunksWebpackPlugin,
NamedLazyChunksWebpackPlugin:
- require('../plugins/named-lazy-chunks-webpack-plugin').NamedLazyChunksWebpackPlugin
+ require('../plugins/named-lazy-chunks-webpack-plugin').NamedLazyChunksWebpackPlugin,
+ InsertConcatAssetsWebpackPlugin:
+ require('../plugins/insert-concat-assets-webpack-plugin').InsertConcatAssetsWebpackPlugin
};
diff --git a/packages/@angular/cli/tasks/eject.ts b/packages/@angular/cli/tasks/eject.ts
index 7f184671ee96..baf67aa6661d 100644
--- a/packages/@angular/cli/tasks/eject.ts
+++ b/packages/@angular/cli/tasks/eject.ts
@@ -23,6 +23,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SilentError = require('silent-error');
const CircularDependencyPlugin = require('circular-dependency-plugin');
+const ConcatPlugin = require('webpack-concat-plugin');
const Task = require('../ember-cli/lib/models/task');
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
@@ -85,6 +86,10 @@ class JsonWebpackSerializer {
};
}
+ private _insertConcatAssetsWebpackPluginSerialize(value: any): any {
+ return value.entryNames;
+ }
+
private _commonsChunkPluginSerialize(value: any): any {
let minChunks = value.minChunks;
switch (typeof minChunks) {
@@ -149,6 +154,10 @@ class JsonWebpackSerializer {
return plugin.options;
}
+ private _concatPlugin(plugin: any) {
+ return plugin.settings;
+ }
+
private _pluginsReplacer(plugins: any[]) {
return plugins.map(plugin => {
let args = plugin.options || undefined;
@@ -184,6 +193,10 @@ class JsonWebpackSerializer {
args = this._globCopyWebpackPluginSerialize(plugin);
this._addImport('@angular/cli/plugins/webpack', 'GlobCopyWebpackPlugin');
break;
+ case angularCliPlugins.InsertConcatAssetsWebpackPlugin:
+ args = this._insertConcatAssetsWebpackPluginSerialize(plugin);
+ this._addImport('@angular/cli/plugins/webpack', 'InsertConcatAssetsWebpackPlugin');
+ break;
case webpack.optimize.CommonsChunkPlugin:
args = this._commonsChunkPluginSerialize(plugin);
this._addImport('webpack.optimize', 'CommonsChunkPlugin');
@@ -210,6 +223,11 @@ class JsonWebpackSerializer {
case LicenseWebpackPlugin:
args = this._licenseWebpackPlugin(plugin);
this._addImport('license-webpack-plugin', 'LicenseWebpackPlugin');
+ break;
+ case ConcatPlugin:
+ args = this._concatPlugin(plugin);
+ this.variableImports['webpack-concat-plugin'] = 'ConcatPlugin';
+ break;
default:
if (plugin.constructor.name == 'AngularServiceWorkerPlugin') {
this._addImport('@angular/service-worker/build/webpack', plugin.constructor.name);
@@ -513,13 +531,13 @@ export default Task.extend({
'postcss-url',
'raw-loader',
'sass-loader',
- 'script-loader',
'source-map-loader',
'istanbul-instrumenter-loader',
'style-loader',
'stylus-loader',
'url-loader',
'circular-dependency-plugin',
+ 'webpack-concat-plugin',
].forEach((packageName: string) => {
packageJson['devDependencies'][packageName] = ourPackageJson['dependencies'][packageName];
});
diff --git a/packages/@angular/cli/utilities/package-chunk-sort.ts b/packages/@angular/cli/utilities/package-chunk-sort.ts
index 2d64707c28bf..a7841aeb544c 100644
--- a/packages/@angular/cli/utilities/package-chunk-sort.ts
+++ b/packages/@angular/cli/utilities/package-chunk-sort.ts
@@ -1,7 +1,7 @@
import { ExtraEntry, extraEntryParser } from '../models/webpack-configs/utils';
// Sort chunks according to a predefined order:
-// inline, polyfills, all scripts, all styles, vendor, main
+// inline, polyfills, all styles, vendor, main
export function packageChunkSort(appConfig: any) {
let entryPoints = ['inline', 'polyfills', 'sw-register'];
@@ -11,10 +11,6 @@ export function packageChunkSort(appConfig: any) {
}
};
- if (appConfig.scripts) {
- extraEntryParser(appConfig.scripts, './', 'scripts').forEach(pushExtraEntries);
- }
-
if (appConfig.styles) {
extraEntryParser(appConfig.styles, './', 'styles').forEach(pushExtraEntries);
}
diff --git a/tests/e2e/tests/build/scripts-array.ts b/tests/e2e/tests/build/scripts-array.ts
index be81248ec3f1..8cbcc439fdaf 100644
--- a/tests/e2e/tests/build/scripts-array.ts
+++ b/tests/e2e/tests/build/scripts-array.ts
@@ -1,7 +1,8 @@
import {
writeMultipleFiles,
expectFileToMatch,
- appendToFile
+ appendToFile,
+ expectFileMatchToExist
} from '../../utils/fs';
import { ng } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';
@@ -9,13 +10,11 @@ import { oneLineTrim } from 'common-tags';
export default function () {
return writeMultipleFiles({
- 'src/string-script.js': 'console.log(\'string-script\');',
+ 'src/string-script.js': 'console.log(\'string-script\'); var number = 1+1;',
'src/input-script.js': 'console.log(\'input-script\');',
'src/lazy-script.js': 'console.log(\'lazy-script\');',
'src/pre-rename-script.js': 'console.log(\'pre-rename-script\');',
- 'src/pre-rename-lazy-script.js': 'console.log(\'pre-rename-lazy-script\');',
- 'src/common-entry-script.js': 'console.log(\'common-entry-script\');',
- 'src/common-entry-style.css': '.common-entry-style { color: red }',
+ 'src/pre-rename-lazy-script.js': 'console.log(\'pre-rename-lazy-script\');'
})
.then(() => appendToFile('src/main.ts', 'import \'./string-script.js\';'))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
@@ -25,10 +24,8 @@ export default function () {
{ input: 'input-script.js' },
{ input: 'lazy-script.js', lazy: true },
{ input: 'pre-rename-script.js', output: 'renamed-script' },
- { input: 'pre-rename-lazy-script.js', output: 'renamed-lazy-script', lazy: true },
- { input: 'common-entry-script.js', output: 'common-entry' }
+ { input: 'pre-rename-lazy-script.js', output: 'renamed-lazy-script', lazy: true }
];
- app['styles'] = [{ input: 'common-entry-style.css', output: 'common-entry' }];
}))
.then(() => ng('build', '--extract-css'))
// files were created successfully
@@ -37,21 +34,24 @@ export default function () {
.then(() => expectFileToMatch('dist/lazy-script.bundle.js', 'lazy-script'))
.then(() => expectFileToMatch('dist/renamed-script.bundle.js', 'pre-rename-script'))
.then(() => expectFileToMatch('dist/renamed-lazy-script.bundle.js', 'pre-rename-lazy-script'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.js', 'common-entry-script'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.css', '.common-entry-style'))
// index.html lists the right bundles
- .then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
- `))
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
`))
- // ensure scripts aren't using script-loader when imported from the app
- .then(() => expectFileToMatch('dist/main.bundle.js', 'console.log(\'string-script\');'));
+ // Ensure scripts can be separately imported from the app.
+ .then(() => expectFileToMatch('dist/main.bundle.js', 'console.log(\'string-script\');'))
+ // Verify uglify, sourcemaps and hashes. Lazy scripts should not get hashes.
+ .then(() => ng('build', '--prod', '--sourcemap'))
+ .then(() => expectFileMatchToExist('dist', /scripts\.[0-9a-f]{20}\.bundle\.js/))
+ .then(fileName => expectFileToMatch(`dist/${fileName}`, 'var number=2;'))
+ .then(() => expectFileMatchToExist('dist', /scripts\.[0-9a-f]{20}\.bundle\.js\.map/))
+ .then(() => expectFileMatchToExist('dist', /renamed-script\.[0-9a-f]{20}\.bundle\.js/))
+ .then(() => expectFileMatchToExist('dist', /renamed-script\.[0-9a-f]{20}\.bundle\.js.map/))
+ .then(() => expectFileToMatch('dist/lazy-script.bundle.js', 'lazy-script'))
+ .then(() => expectFileToMatch('dist/renamed-lazy-script.bundle.js', 'pre-rename-lazy-script'));
}
diff --git a/tests/e2e/tests/build/styles/extract-css.ts b/tests/e2e/tests/build/styles/extract-css.ts
index c527232932c8..834b16dbba25 100644
--- a/tests/e2e/tests/build/styles/extract-css.ts
+++ b/tests/e2e/tests/build/styles/extract-css.ts
@@ -21,9 +21,7 @@ export default function () {
'src/input-style.css': '.input-style { color: red }',
'src/lazy-style.css': '.lazy-style { color: red }',
'src/pre-rename-style.css': '.pre-rename-style { color: red }',
- 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }',
- 'src/common-entry-style.css': '.common-entry-style { color: red }',
- 'src/common-entry-script.js': 'console.log(\'common-entry-script\');'
+ 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }'
}))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
@@ -32,10 +30,8 @@ export default function () {
{ input: 'input-style.css' },
{ input: 'lazy-style.css', lazy: true },
{ input: 'pre-rename-style.css', output: 'renamed-style' },
- { input: 'pre-rename-lazy-style.css', output: 'renamed-lazy-style', lazy: true },
- { input: 'common-entry-style.css', output: 'common-entry' }
+ { input: 'pre-rename-lazy-style.css', output: 'renamed-lazy-style', lazy: true }
];
- app['scripts'] = [{ input: 'common-entry-script.js', output: 'common-entry' }];
}))
.then(() => ng('build', '--extract-css'))
// files were created successfully
@@ -44,8 +40,6 @@ export default function () {
.then(() => expectFileToMatch('dist/lazy-style.bundle.css', '.lazy-style'))
.then(() => expectFileToMatch('dist/renamed-style.bundle.css', '.pre-rename-style'))
.then(() => expectFileToMatch('dist/renamed-lazy-style.bundle.css', '.pre-rename-lazy-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.css', '.common-entry-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.js', 'common-entry-script'))
// there are no js entry points for css only bundles
.then(() => expectToFail(() => expectFileToExist('dist/style.bundle.js')))
.then(() => expectToFail(() => expectFileToExist('dist/lazy-style.bundle.js')))
@@ -53,14 +47,12 @@ export default function () {
.then(() => expectToFail(() => expectFileToExist('dist/renamed-lazy-style.bundle.js')))
// index.html lists the right bundles
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
`))
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
`))
@@ -72,13 +64,10 @@ export default function () {
.then(() => expectFileToMatch('dist/lazy-style.bundle.js', '.lazy-style'))
.then(() => expectFileToMatch('dist/renamed-style.bundle.js', '.pre-rename-style'))
.then(() => expectFileToMatch('dist/renamed-lazy-style.bundle.js', '.pre-rename-lazy-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.js', '.common-entry-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.js', 'common-entry-script'))
// index.html lists the right bundles
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
diff --git a/tests/e2e/tests/build/styles/styles-array.ts b/tests/e2e/tests/build/styles/styles-array.ts
index 5cbb608070a7..8149363993f3 100644
--- a/tests/e2e/tests/build/styles/styles-array.ts
+++ b/tests/e2e/tests/build/styles/styles-array.ts
@@ -4,7 +4,6 @@ import {
} from '../../../utils/fs';
import { ng } from '../../../utils/process';
import { updateJsonFile } from '../../../utils/project';
-import { expectToFail } from '../../../utils/utils';
import { oneLineTrim } from 'common-tags';
export default function () {
@@ -13,9 +12,7 @@ export default function () {
'src/input-style.css': '.input-style { color: red }',
'src/lazy-style.css': '.lazy-style { color: red }',
'src/pre-rename-style.css': '.pre-rename-style { color: red }',
- 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }',
- 'src/common-entry-style.css': '.common-entry-style { color: red }',
- 'src/common-entry-script.js': 'console.log(\'common-entry-script\');'
+ 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }'
})
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
@@ -24,10 +21,8 @@ export default function () {
{ input: 'input-style.css' },
{ input: 'lazy-style.css', lazy: true },
{ input: 'pre-rename-style.css', output: 'renamed-style' },
- { input: 'pre-rename-lazy-style.css', output: 'renamed-lazy-style', lazy: true },
- { input: 'common-entry-style.css', output: 'common-entry' }
+ { input: 'pre-rename-lazy-style.css', output: 'renamed-lazy-style', lazy: true }
];
- app['scripts'] = [{ input: 'common-entry-script.js', output: 'common-entry' }];
}))
.then(() => ng('build', '--extract-css'))
// files were created successfully
@@ -36,18 +31,14 @@ export default function () {
.then(() => expectFileToMatch('dist/lazy-style.bundle.css', '.lazy-style'))
.then(() => expectFileToMatch('dist/renamed-style.bundle.css', '.pre-rename-style'))
.then(() => expectFileToMatch('dist/renamed-lazy-style.bundle.css', '.pre-rename-lazy-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.css', '.common-entry-style'))
- .then(() => expectFileToMatch('dist/common-entry.bundle.js', 'common-entry-script'))
// index.html lists the right bundles
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
`))
.then(() => expectFileToMatch('dist/index.html', oneLineTrim`
-
`));