@@ -4,11 +4,19 @@ import * as HtmlWebpackPlugin from 'html-webpack-plugin';
4
4
import * as webpack from 'webpack' ;
5
5
import * as atl from 'awesome-typescript-loader' ;
6
6
7
- import { SystemJSRegisterPublicModules } from './webpack-plugin-systemjs-registry' ;
8
7
import { findLazyModules } from './find-lazy-modules' ;
9
8
10
9
11
10
export function getWebpackCommonConfig ( projectRoot : string , sourceDir : string ) {
11
+ const sourceRoot = path . resolve ( projectRoot , `./${ sourceDir } ` ) ;
12
+
13
+ const lazyModules = findLazyModules ( path . resolve ( projectRoot , sourceDir ) ) ;
14
+ const entries = Object . assign ( {
15
+ main : [ path . join ( sourceRoot , 'main.ts' ) ] ,
16
+ polyfills : path . join ( sourceRoot , 'polyfills.ts' )
17
+ } , lazyModules ) ;
18
+
19
+
12
20
return {
13
21
devtool : 'source-map' ,
14
22
resolve : {
@@ -22,6 +30,25 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
22
30
filename : '[name].bundle.js'
23
31
} ,
24
32
module : {
33
+ preLoaders : [
34
+ {
35
+ test : / \. j s $ / ,
36
+ loader : 'source-map-loader' ,
37
+ exclude : [
38
+ path . resolve ( projectRoot , 'node_modules/rxjs' ) ,
39
+ path . resolve ( projectRoot , 'node_modules/@angular' ) ,
40
+ ]
41
+ } ,
42
+ {
43
+ test : / ( s y s t e m j s _ c o m p o n e n t _ r e s o l v e r | s y s t e m _ j s _ n g _ m o d u l e _ f a c t o r y _ l o a d e r ) \. j s $ / ,
44
+ loader : 'string-replace-loader' ,
45
+ query : {
46
+ search : '(lang_1(.*[\\n\\r]+\\s*\\.|\\.))?(global(.*[\\n\\r]+\\s*\\.|\\.))?(System|SystemJS)(.*[\\n\\r]+\\s*\\.|\\.)import' ,
47
+ replace : 'System.import' ,
48
+ flags : 'g'
49
+ }
50
+ } ,
51
+ ] ,
25
52
loaders : [
26
53
{
27
54
test : / \. t s $ / ,
@@ -67,34 +94,6 @@ export function getWebpackCommonConfig(projectRoot: string, sourceDir: string) {
67
94
from : '**/*' ,
68
95
to : path . resolve ( projectRoot , './dist' )
69
96
} ] ) ,
70
- // new SystemJSRegisterPublicModules({
71
- // // automatically configure SystemJS to load webpack chunks (defaults to true)
72
- // bundlesConfigForChunks: true,
73
- //
74
- // // select which modules to expose as public modules
75
- // registerModules: [
76
- // // "default" filters provided are "local" and "public"
77
- // { filter: 'public' },
78
- // //
79
- // // // keyname allows a custom naming system for public modules
80
- // // {
81
- // // filter: 'local',
82
- // // keyname: 'app/[relPath]'
83
- // // },
84
- // //
85
- // // // keyname can be a function
86
- // // {
87
- // // filter: 'public',
88
- // // keyname: (module) => 'publicModule-' + module.id
89
- // // },
90
- // //
91
- // // // filter can also be a function
92
- // // {
93
- // // filter: (m) => m.relPath.match(/src/),
94
- // // keyname: 'random-naming-system-[id]'
95
- // // }
96
- // ]
97
- // })
98
97
] ,
99
98
node : {
100
99
fs : 'empty' ,
0 commit comments