ng2-scrollspy/src/core/service 404 (Not Found)
alexciesielski opened this issue · comments
Hi,
I'm building an Angular 2 Typescript project using angular-cli (https://github.com/angular/angular-cli). They use SystemJS as loader.
After adding ng2-scrollspy to main.ts (bootstrap) and configuring the package in SystemJS I get the following errors:
zone.js:101 GET http://localhost:4200/vendor/ng2-scrollspy/src/core/service 404 (Not Found)
zone.js:101 GET http://localhost:4200/vendor/ng2-scrollspy/src/core/window.directive 404 (Not Found)
zone.js:101 GET http://localhost:4200/vendor/ng2-scrollspy/src/core/element.directive 404 (Not Found)
I have checked /vendor/ng2-scrollspy. All scripts are there (I have used ng2-scrollspy/**/*.js
during copy)
It seems that the file extension is not appended, although I explicitly use defaultExtension: 'js'.
This is my system-config.ts
:
/** Map relative paths to URLs. */
const map: any = {
'ng2-scrollspy': 'vendor/ng2-scrollspy/src/index.js'
};
/** User packages configuration. */
const packages: any = {
'ng2-scrollspy': {
format: 'cjs',
defaultExtension: 'js'
}
};
What could be wrong?
Thanks!
Hi,
can you trying your SystemJS config setting:
paths: {
"ng2-scrollspy/*": "node_modules/ng2-scrollspy/*",
}
or "verdor/ng2-scrollspy/*"
@ciesielskico try the following
/** Map relative paths to URLs. */
const map: any = {
'ng2-scrollspy': 'vendor/ng2-scrollspy',
'immutable': 'vendor/immutable/dist/immutable.js'
};
/** User packages configuration. */
const packages: any = {
'ng2-scrollspy': {
main: 'index.js',
defaultExtension: 'js'
}
};
Make sure you have immutable
installed, since that is ng2-scrollspy
's dependency. Then you import plugins as follows import {ScrollSpyParallaxDirective} from 'ng2-scrollspy/src/plugin/parallax.directive';
Got exactly the same issue and @knikel's fix made it work. Thank you !
Please try new version v0.3.0.
Make sure you read docs for new declaration system.
I will try to create more documentation and example during next week.
I'm still not able to load the package via systemJS, this is not working for me;
System.config({
paths: {
'npm:': 'node_modules/'},
map: {
'ng2-scrollspy': 'npm:ng2-scrollspy',
'immutable': 'npm:immutable/dist/immutable.js'
},
packages: {
'ng2-scrollspy': {
main: 'index.js',
defaultExtension: 'js'
}
}
});
ImmutableJs is no longer a dependency.
Also main should point to node_modules/ng2-scrollspy/dist/index.js