Skip to content

How do I use a 3rd party lib required by a script tag in the html file? #1171

Description

@NullVoxPopuli

I've given up with imports/requires, so I am trying the script-tag way.

in src/index.html:

 {{#unless environment.production}}
<!-- These two files (used for testing) cannot be included the 'normal' way, because angular-cli's build tools don't resolve dependencies of 3rd party libs. --><scriptsrc="/dist/vendor/sinon/pkg/sinon.js" type="text/javascript"></script><scriptsrc="/dist/vendor/axios/dist/axios.js" type="text/javascript"></script>
{{/unless}}
</head>

and in angular-cli-build.js:

vendorNpmFiles: [
...
'sinon/**/*.js',],

and then in my test:

declarevarsinon:any;
...
beforeEach(()=>sandbox=sinon.sandbox.create());

I get the error:

 ReferenceError: sinon is not defined

$ ng --version
angular-cli: 1.0.0-beta.6
node: 5.10.1
os: linux x64

how do I use the library?

after running ng test, there are 0 console errors in the opened chrome window. The errors are only in the terminal.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions