Skip to content

Commit 7906d4f

Browse files
authored
chore: fix moduleId loader on plunkers (angular#3393)
1 parent d231f82 commit 7906d4f

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

public/docs/_examples/_boilerplate/src/systemjs-angular-loader.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ module.exports.translate = function(load){
88

99
var basePathParts = url.pathname.split('/');
1010

11-
if (url.href.indexOf('plnkr') != -1) {
12-
basePathParts.shift();
13-
basePathParts.shift();
14-
}
15-
1611
basePathParts.pop();
1712
var basePath = basePathParts.join('/');
13+
14+
var baseHref = new URL(this.baseURL).pathname;
15+
16+
basePath = basePath.replace(baseHref, '');
17+
1818
load.source = load.source
1919
.replace(templateUrlRegex, function(match, quote, url){
2020
let resolvedUrl = url;
@@ -30,7 +30,7 @@ module.exports.translate = function(load){
3030

3131
while ((match = stringRegex.exec(relativeUrls)) !== null) {
3232
if (match[2].startsWith('.')) {
33-
urls.push(`'${basePath.substr(1)}${match[2].substr(1)}'`);
33+
urls.push(`'${basePath}${match[2].substr(1)}'`);
3434
} else {
3535
urls.push(`'${match[2]}'`);
3636
}

public/docs/_examples/_boilerplate/src/systemjs.config.web.build.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
},
3535
// map tells the System loader where to look for things
3636
map: {
37-
'ng-loader': './systemjs-angular-loader.js',
3837
// our app is within the app folder
3938
'app': 'app',
4039

@@ -75,7 +74,7 @@
7574
defaultExtension: 'ts',
7675
meta: {
7776
'./*.ts': {
78-
loader: 'ng-loader'
77+
loader: 'systemjs-angular-loader.js'
7978
}
8079
}
8180
},

public/docs/_examples/_boilerplate/src/systemjs.config.web.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
},
3232
// map tells the System loader where to look for things
3333
map: {
34-
'ng-loader': './systemjs-angular-loader.js',
3534
// our app is within the app folder
3635
'app': 'app',
3736

@@ -62,7 +61,7 @@
6261
defaultExtension: 'ts',
6362
meta: {
6463
'./*.ts': {
65-
loader: 'ng-loader'
64+
loader: 'systemjs-angular-loader.js'
6665
}
6766
}
6867
},

0 commit comments

Comments
 (0)