Reputation: 95
Trying to use d3.js in my project but getting error "Cannot find module d3" when importing it like this
import * as d3 from 'd3';
Package.json
"dependencies": {
....
"d3" : "4.1.1"
},
systemjs.config.js
var map = {
'app': 'appScripts', // 'dist',
'@angular': 'libs/@angular',
'angular2-in-memory-web-api': 'libs/angular2-in-memory-web-api',
'd3' : 'libs/d3'
};
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' }, ...
'd3': { main: 'd3.js', defaultExtension: 'js' } };
My d3.js is in right folder.
Note that all other libraries are working except that one. Also I tried to do npm install d3 along with fixing directives and it wasnt working as well. If it matters Im using asp.net core project for building angular app.
Upvotes: 1
Views: 1114
Reputation: 15270
Just include d3.js with <script>
tag and install appropriate typings then you should be able to use d3 without imports.
Upvotes: 1