Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable us use underscore.js library in this project #3

Open
Apps-23 opened this issue Oct 7, 2016 · 1 comment
Open

Unable us use underscore.js library in this project #3

Apps-23 opened this issue Oct 7, 2016 · 1 comment

Comments

@Apps-23
Copy link

Apps-23 commented Oct 7, 2016

1.I have installed underscore as
npm install underscore

2.Then I have included it in my systemjs.config.js

 System.config({
        paths: {
            // paths serve as alias
            'npm:': 'node_modules/',
            'underscore': 'node_modules/underscore/underscore.js'
        },
 packages: {
            app: {
                main: './main.js',
                defaultExtension: 'js'
            },
            rxjs: {
                defaultExtension: 'js'
            },

            'angular-in-memory-web-api': {
                main: './index.js',
                defaultExtension: 'js'
            },

            'underscore': {
                main: 'underscore.js',
                defaultExtension: 'js'
            }
        }
  1. Now to use it in the pager.service.ts
    import * as _ from 'underscore';
    But it says : cannot find module underscore

My directory structure goes like:

>app
       >services
           --index.ts
           --pager.service.ts
       >templates
           --app.component.html
app.component.ts
app.module.ts
main.ts
>node modules
       >underscore
           --underscore.js
>typings
index.html
typings.json
package.json
systemjs.config.js
tsconfig.json

Any guidance would be appreciated:)

@rochapablo
Copy link

rochapablo commented Jan 5, 2017

Following the files config and running npm install && npm start it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants