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.

How to add external libs to webpack.2 , angular-cli 1.0.0-beta11

See original GitHub issue

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Mac OSX El Capitan

  1. Versions. Please run ng --version. If there’s nothing outputted, please run in a Terminal: node --version and paste the result here:

1.0.0-beta.11-webpack.2

  1. Repro steps. Was this an app that wasn’t created using the CLI? What change did you do on your code? etc.

I am trying to add charts.js to angular 2 RC5. But after doing npm installs and referencing the script directly into index.html like this

<script src="node_modules/chart.js/dist/Chart.bundle.min.js"></script>

it does not get picked up and gives error of not found in console. What is the way to load external scripts in newest version?

  1. The log given by the failure. Normally this include a stack trace and some more information.
  2. Mention any other details that might be useful.

Thanks! We’ll be in touch soon.

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
iamyojimbocommented, Aug 17, 2016

if using webpack, then pretty much all libraries should be able to be included with a simple const jQuery = require('jquery') and nothing more. Not even typings.

5reactions
reflogcommented, Aug 12, 2016

That was an example, just add your library name…

On Fri, Aug 12, 2016, 18:43 LunicLynx notifications@github.com wrote:

The import * as charts from ‘charts’ does not work for me.

I’m getting the following error:

ERROR in [default] C:\Users\XXXXX\Source\Repos\XXXXXX\src\main.ts:5:23 Cannot find module ‘chart’.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1668#issuecomment-239481704, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGtNHqqlHv2Iux3wTW9gxyLvstCZZhcks5qfJSRgaJpZM4JjHuy .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add css library to project generated with angular-cli ...
To upgrade from 1.0.0-beta.11-webpack.2 to 1.0.0-beta.11-webpack.3 , run: npm uninstall -g angular-cli npm cache clean npm install -g ...
Read more >
angular/angular-cli - Gitter
Does anyone use jQuery or external libs in angular-cli 1.0.0-beta.11-webpack.2 successfully ? Could you please share with me about your tips ~!.
Read more >
How to include assets from node_modules in angular cli project
How to include assets from external library into Angular CLI project ... If your angular-cli version is greater than 1.0.0-beta.11-webpack, then you should ......
Read more >
Angular-CLI Meets Webpack. the single greatest improvement ...
We'll build a quick Material 2 demo with a few md-components using these libraries: angular-cli beta-11 (circa: “1.0.0-beta.11-webpack.2”) ...
Read more >
Externals - webpack
For example, to include jQuery from a CDN instead of bundling it: index.html ... For example, if the external library is a CommonJS...
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