admin管理员组文章数量:1410724
Hello I have the following config set up for systemJS:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js',
map: {'./app' : './DesktopModules/RegentDMS/app'}
},
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
The default extension works fine but I get is a 404 error in the console that says:
GET http://localhost:81/app/boot 404 (Not Found)
But if I change it to the following:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js'
},
}
});
System.import('/DesktopModules/RegentDMS/app/boot.js')
.then(null, console.error.bind(console));
Then it does work.
QUESTION:
how can I set up the MAP setting so that I can use the short hand app/ to refer to the absolute path of DesktopModules/RegentDMS/app in import statements like app/boot (meaning DesktopModules/RegentDMS/app/boot.js)
Thanks
EDIT #1:
So i changed the ./app to app as suggested and tried both of the following:
map: { 'app': './DesktopModules/RegentDMS/app' }
map: { app: './DesktopModules/RegentDMS/app' }
and this does not work when using any of the following import statements:
System.import('app/boot')
System.import('./app/boot')
I get the following error for both:
http://localhost:81/app/boot 404 (Not Found)
SOLUTION:
Move the map declaration to the config object like so:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js'
}
},
map: { 'app': './DesktopModules/RegentDMS/app' }
});
System.import('app/boot')
.then(null, console.error.bind(console));
Hello I have the following config set up for systemJS:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js',
map: {'./app' : './DesktopModules/RegentDMS/app'}
},
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
The default extension works fine but I get is a 404 error in the console that says:
GET http://localhost:81/app/boot 404 (Not Found)
But if I change it to the following:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js'
},
}
});
System.import('/DesktopModules/RegentDMS/app/boot.js')
.then(null, console.error.bind(console));
Then it does work.
QUESTION:
how can I set up the MAP setting so that I can use the short hand app/ to refer to the absolute path of DesktopModules/RegentDMS/app in import statements like app/boot (meaning DesktopModules/RegentDMS/app/boot.js)
Thanks
EDIT #1:
So i changed the ./app to app as suggested and tried both of the following:
map: { 'app': './DesktopModules/RegentDMS/app' }
map: { app: './DesktopModules/RegentDMS/app' }
and this does not work when using any of the following import statements:
System.import('app/boot')
System.import('./app/boot')
I get the following error for both:
http://localhost:81/app/boot 404 (Not Found)
SOLUTION:
Move the map declaration to the config object like so:
System.config({
packages: {
//sets the root path of the Angular2 App
'DesktopModules/RegentDMS/app': {
//module format expected in application, register = System.register or System.registerDynamic patibility module format
format: 'register',
//default file extension for paths
defaultExtension: 'js'
}
},
map: { 'app': './DesktopModules/RegentDMS/app' }
});
System.import('app/boot')
.then(null, console.error.bind(console));
Share
Improve this question
edited Jan 17, 2016 at 0:02
J King
asked Jan 16, 2016 at 19:32
J KingJ King
4,44410 gold badges61 silver badges116 bronze badges
1
- does not work, edited answer for more details – J King Commented Jan 16, 2016 at 23:47
1 Answer
Reset to default 5As @Langley suggested in ment, you should use app
, not ./app
(name not path), and move map
definitions from packages
object to the config
object.
The map option ... allows you to map a module alias to a location or package:
https://github./systemjs/systemjs/blob/master/docs/config-api.md#map
本文标签: javascriptcan not get MAP to work within systemconfig packages for SystemJSStack Overflow
版权声明:本文标题:javascript - can not get MAP to work within system.config packages for SystemJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744835566a2627609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论