Comments (3)
Another way to import that works is:
import { csv } from 'd3-fetch'
csv('/data/output.csv').then(function(data) {
console.log('csv', data)
})
from d3-webpack-babel-typescript.
Two options in tsconfig.json deal with default imports:
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
from d3-webpack-babel-typescript.
Following are the ways to deal with default imports
import * as d3Fetch from 'd3-fetch'
--> all exports in d3-fetch will be made available under d3Fetchimport { csv } from 'd3-fetch
--> only export function csv(){} will be imported and can be used directly without any prefix- enable
allowSyntheticDefaultImports
andesModuleInterop
flags in tsconfig.json and thenimport d3Fetch from 'd3-fetch'
will work.
from d3-webpack-babel-typescript.
Related Issues (10)
- Convert code to Babel + Typescript HOT 3
- Add Production workflow HOT 1
- Dev workflow with stackbar & real data HOT 2
- Implement Test workflow HOT 1
- API maxValue unit test failing due to `categories` API not implemented HOT 1
- Add Demo workflow HOT 1
- Make webpack config DRY
- Publish library to NPM HOT 1
- Add treemap chart to vizintel-charts library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-webpack-babel-typescript.