File tree 2 files changed +9
-9
lines changed
packages/angular-cli/models
2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,9 @@ export function getWebpackCommonConfig(
57
57
58
58
// add entry points and lazy chunks
59
59
globalScripts . forEach ( script => {
60
+ let scriptPath = `script-loader!${ script . path } ` ;
60
61
if ( script . lazy ) { lazyChunks . push ( script . entry ) ; }
61
- entryPoints [ script . entry ] = ( entryPoints [ script . entry ] || [ ] ) . concat ( script . path ) ;
62
- } ) ;
63
-
64
- // load global scripts using script-loader
65
- extraRules . push ( {
66
- include : globalScripts . map ( ( script ) => script . path ) , test : / \. j s $ / , loader : 'script-loader'
62
+ entryPoints [ script . entry ] = ( entryPoints [ script . entry ] || [ ] ) . concat ( scriptPath ) ;
67
63
} ) ;
68
64
}
69
65
@@ -101,7 +97,7 @@ export function getWebpackCommonConfig(
101
97
extraPlugins . push ( new webpack . optimize . CommonsChunkPlugin ( {
102
98
name : 'vendor' ,
103
99
chunks : [ 'main' ] ,
104
- minChunks : ( module : any ) => module . userRequest && module . userRequest . startsWith ( nodeModules )
100
+ minChunks : ( module : any ) => module . resource && module . resource . startsWith ( nodeModules )
105
101
} ) ) ;
106
102
}
107
103
Original file line number Diff line number Diff line change 1
1
import {
2
2
writeMultipleFiles ,
3
- expectFileToMatch
3
+ expectFileToMatch ,
4
+ appendToFile
4
5
} from '../../utils/fs' ;
5
6
import { ng } from '../../utils/process' ;
6
7
import { updateJsonFile } from '../../utils/project' ;
@@ -16,6 +17,7 @@ export default function () {
16
17
'src/common-entry-script.js' : 'console.log(\'common-entry-script\');' ,
17
18
'src/common-entry-style.css' : '.common-entry-style { color: red }' ,
18
19
} )
20
+ . then ( ( ) => appendToFile ( 'src/main.ts' , 'import \'./string-script.js\';' ) )
19
21
. then ( ( ) => updateJsonFile ( 'angular-cli.json' , configJson => {
20
22
const app = configJson [ 'apps' ] [ 0 ] ;
21
23
app [ 'scripts' ] = [
@@ -48,5 +50,7 @@ export default function () {
48
50
<script type="text/javascript" src="scripts.bundle.js"></script>
49
51
<script type="text/javascript" src="vendor.bundle.js"></script>
50
52
<script type="text/javascript" src="main.bundle.js"></script>
51
- ` ) ) ;
53
+ ` ) )
54
+ // ensure scripts aren't using script-loader when imported from the app
55
+ . then ( ( ) => expectFileToMatch ( 'dist/main.bundle.js' , 'console.log(\'string-script\');' ) ) ;
52
56
}
You can’t perform that action at this time.
0 commit comments