Skip to content

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

Open
@Apps-23

Description

@Apps-23

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:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions