Skip to content

Commit

Permalink
fix(@angular/cli): take publicPath into account when building entry map
Browse files Browse the repository at this point in the history
Fixes #7628
  • Loading branch information
hansl committed Sep 8, 2017
1 parent 1be82bb commit e6f3841
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Add assets from `ConcatPlugin` to index.html.
import * as path from 'path';

export class InsertConcatAssetsWebpackPlugin {
// Priority list of where to insert asset.
Expand All @@ -23,7 +24,7 @@ export class InsertConcatAssetsWebpackPlugin {
throw new Error(`Cannot find file for ${entryName} script.`);
}

return fileName;
return path.join(htmlPluginData.assets.publicPath, fileName);
});

let insertAt = 0;
Expand Down
18 changes: 15 additions & 3 deletions tests/e2e/tests/misc/deploy-url.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { killAllProcesses } from '../../utils/process';
import { request } from '../../utils/http';
import { ngServe } from '../../utils/project';
import { ngServe, updateJsonFile } from '../../utils/project';
import { getGlobalVariable } from '../../utils/env';
import { writeMultipleFiles } from '../../utils/fs';

export default function () {
// Skip this in Appveyor tests.
Expand All @@ -10,18 +11,29 @@ export default function () {
}

return Promise.resolve()
.then(() => writeMultipleFiles({
'src/string-script.js': 'console.log(\'string-script\'); var number = 1+1;',
})
.then(() => updateJsonFile('.angular-cli.json', configJson => {
configJson['apps'][0]['scripts'] = [
'string-script.js',
];
}))
// check when setup through command line arguments
.then(() => ngServe('--deploy-url', '/deployurl/', '--base-href', '/deployurl/'))
.then(() => request('http://localhost:4200'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
throw new Error('Response does not match expected value. (1)');
}
if (!body.match(/"\/deployurl\/scripts.bundle.js"/)) {
throw new Error('Response does not match expected value. (2)');
}
})
.then(() => request('http://localhost:4200/deployurl/'))
.then(body => {
if (!body.match(/<app-root><\/app-root>/)) {
throw new Error('Response does not match expected value.');
throw new Error('Response does not match expected value. (3)');
}
})
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; });
Expand Down

0 comments on commit e6f3841

Please sign in to comment.