2

Im making a little angular2 app, which uses the ng2-slugify package, and for some reason it doesn't find one of the slugify required files which is in the same folder (The file name is charmaps.js, and it's there 100%).

enter image description here

The file is being imported like this, which seems to work for every other single file in the project, which includes files I've made myself, hence why I don't understand why it doesn't work.

import { Charmaps } from './charmaps';

I've tried using relative and absolute paths in the imports, adding it to the systemjs.config.js, but nothing.

One of the things that I've noticed when I run npm start is that when it gives the 404 code on the npm output on the console, it lists it as charmaps, and not charmaps.js like the rest of the files, which I find odd, because even when I map it in the systemjs as charmaps.js it still lists it as charmaps.

Anyway this is my first project from the groundup that uses node, so maybe there's something that's missing.

[1] 16.10.07 16:31:08 404 GET /node_modules/ng2-slugify/charmaps

This is the 404 on the npm output.

GET http://localhost:3000/node_modules/ng2-slugify/charmaps 404 (Not Found)

This is the error on the chrome console. Is there something I'm missing?

1 Answer 1

1

You need to tell systemjs.config.ts to load slug module.

map:{
     "ng2-slugify": "node_modules/ng2-slugify/ng2-slugify.js"
    }

Then,

import {Slug} from 'ng2-slugify';
Sign up to request clarification or add additional context in comments.

4 Comments

I already have slug set up, it's just the charmap which is giving me problems.
I think so, from what I understand when it was set up the moment in installed the package from npm.
Does this project exist? In github, I'm unable to find anything related to it. So be careful .
This is the npm2 page https://www.npmjs.com/package/ng2-slugify and this is the github one https://github.com/toHero/ng2-slugify

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.