javascript - can not get MAP to work within system.config packages for SystemJS -
hello have following config set systemjs:
system.config({ packages: { //sets root path of angular2 app 'desktopmodules/regentdms/app': { //module format expected in application, register = system.register or system.registerdynamic compatibility module format format: 'register', //default file extension paths defaultextension: 'js', map: {'./app' : './desktopmodules/regentdms/app'} }, } }); system.import('app/boot') .then(null, console.error.bind(console));
the default extension works fine 404 error in console says:
get http://localhost:81/app/boot 404 (not found)
but if change following:
system.config({ packages: { //sets root path of angular2 app 'desktopmodules/regentdms/app': { //module format expected in application, register = system.register or system.registerdynamic compatibility module format format: 'register', //default file extension paths defaultextension: 'js' }, } }); system.import('/desktopmodules/regentdms/app/boot.js') .then(null, console.error.bind(console));
then work.
question:
how can set map setting can use short hand app/ refer absolute path of desktopmodules/regentdms/app in import statements app/boot (meaning desktopmodules/regentdms/app/boot.js)
thanks
edit #1:
so changed ./app app suggested , tried both of following:
map: { 'app': './desktopmodules/regentdms/app' } map: { app: './desktopmodules/regentdms/app' }
and not work when using of following import statements:
system.import('app/boot') system.import('./app/boot')
i following error both:
http://localhost:81/app/boot 404 (not found)
solution:
move map declaration config object so:
system.config({ packages: { //sets root path of angular2 app 'desktopmodules/regentdms/app': { //module format expected in application, register = system.register or system.registerdynamic compatibility module format format: 'register', //default file extension paths defaultextension: 'js' } }, map: { 'app': './desktopmodules/regentdms/app' } }); system.import('app/boot') .then(null, console.error.bind(console));
as @langley suggested in comment, should use app
, not ./app
(name not path), , move map
definitions packages
object config
object.
the map option ... allows map module alias location or package:
https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#map
Comments
Post a Comment