question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to import with SystemJS

See original GitHub issue

Hi,

Sorry to bother you with that but I am unable to use SystemJS to import your plugin.

I have added to the map object of systemJs :

'notifications': 'node_modules/angular2-notifications'

And to the packages object :

'notifications': { main: 'components.js', defaultExtension: 'js' }

Then in my component ts file, I just do :

import { SimpleNotificationsComponent } from 'notifications'

However, when I run tsc, I always have this error : app/components/core/app/app.component.ts(4,46): error TS2307: Cannot find module 'notifications

Am I doing something wrong ?

Thanks in advance

Regards

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

6reactions
chriscurnowcommented, Mar 5, 2017

I simply have not been able to get this to work with Angular-CLI.

I don’t know what the “note about defining directories in angular-cli-builder” means. Where should you add this code?

It would help a lot if you could write a more detailed set of instructions for Angular CLI.

If I could work out how implement this with Angular-CLI I would happily write something and create a PR.

6reactions
RenanCostaNascimentocommented, Jul 14, 2016

@johnnyPescarul I had the same problem, fixed it by changing the name of the module in system.config.js to “angular2-notifications”.

system.config.js:

var map = {
    'angular2-notifications':     'node_modules/angular2-notifications'
  };
var packages = {
    'angular2-notifications':     { main: 'components.js', defaultExtension: 'js' }
  };

component.ts: import {NotificationsService, SimpleNotificationsComponent} from "angular2-notifications"

Read more comments on GitHub >

github_iconTop Results From Across the Web

systemjs/errors.md at main - GitHub
System.js treats failing import maps as a warning. It skips the failed import map and moves on processing the next one if present....
Read more >
Error trying to import 'systemjs' to use import dynamically
I am trying to use SystemJS to import a module that lives on an external server ... Error: Module not found: Error: Can't...
Read more >
systemjs/systemjs - Gitter
Hi everyone! I'm getting Error: Unable to resolve bare specifier in my unit tests which makes sense because no import map exists here...
Read more >
The Recommended Setup - Single SPA
The single-spa core team recommends using SystemJS + import maps as a module loader for the microfrontends. Alternatively, you may use global variables...
Read more >
Troubleshooting Order Hub customizations - IBM
Unable to resolve bare specifier ... To resolve this issue: Check the import-map.json file and see the paths starts with a forward slash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found