File tree 2 files changed +15
-1
lines changed
packages/@angular/cli/commands
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({
239
239
commandOptions . forceTsCommonjs = true ;
240
240
}
241
241
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
+
242
247
const BuildTask = require ( '../tasks/build' ) . default ;
243
248
244
249
const buildTask = new BuildTask ( {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ng } from '../../utils/process';
2
2
import { copyProjectAsset } from '../../utils/assets' ;
3
3
import { expectFileToMatch , writeMultipleFiles } from '../../utils/fs' ;
4
4
import { updateJsonFile } from '../../utils/project' ;
5
+ import { getGlobalVariable } from '../../utils/env' ;
5
6
6
7
7
8
export default function ( ) {
@@ -27,5 +28,13 @@ export default function () {
27
28
// verify --deploy-url is applied to non-extracted css urls
28
29
. then ( ( ) => ng ( 'build' , '--deploy-url=deployUrl/' , '--extract-css=false' ) )
29
30
. 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 \/ " ; / ) ) ;
31
40
}
You can’t perform that action at this time.
0 commit comments