File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/@angular/cli/commands Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ const BuildCommand = Command.extend({
239239 commandOptions . forceTsCommonjs = true ;
240240 }
241241
242+ // Add trailing slash if missing to prevent https://github.com/angular/angular-cli/issues/7295
243+ if ( commandOptions . deployUrl && commandOptions . deployUrl . substr ( - 1 ) !== '/' ) {
244+ commandOptions . deployUrl += '/' ;
245+ }
246+
242247 const BuildTask = require ( '../tasks/build' ) . default ;
243248
244249 const buildTask = new BuildTask ( {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ng } from '../../utils/process';
22import { copyProjectAsset } from '../../utils/assets' ;
33import { expectFileToMatch , writeMultipleFiles } from '../../utils/fs' ;
44import { updateJsonFile } from '../../utils/project' ;
5+ import { getGlobalVariable } from '../../utils/env' ;
56
67
78export default function ( ) {
@@ -27,5 +28,13 @@ export default function () {
2728 // verify --deploy-url is applied to non-extracted css urls
2829 . then ( ( ) => ng ( 'build' , '--deploy-url=deployUrl/' , '--extract-css=false' ) )
2930 . then ( ( ) => expectFileToMatch ( 'dist/styles.bundle.js' ,
30- / _ _ w e b p a c k _ r e q u i r e _ _ .p \+ \" m o r e \. [ 0 - 9 a - f ] { 20 } \. p n g \" / ) ) ;
31+ / _ _ w e b p a c k _ r e q u i r e _ _ .p \+ \" m o r e \. [ 0 - 9 a - f ] { 20 } \. p n g \" / ) )
32+ . then ( ( ) => expectFileToMatch ( 'dist/inline.bundle.js' ,
33+ / _ _ w e b p a c k _ r e q u i r e _ _ \. p = " d e p l o y U r l \/ " ; / ) )
34+ // verify slash is appended to the end of --deploy-url if missing
35+ . then ( ( ) => ng ( 'build' , '--deploy-url=deployUrl' , '--extract-css=false' ) )
36+ // skip this in ejected tests
37+ . then ( ( ) => getGlobalVariable ( 'argv' ) . eject
38+ ? Promise . resolve ( )
39+ : expectFileToMatch ( 'dist/inline.bundle.js' , / _ _ w e b p a c k _ r e q u i r e _ _ \. p = " d e p l o y U r l \/ " ; / ) ) ;
3140}
You can’t perform that action at this time.
0 commit comments