Support for import via es6 import
See original GitHub issueIs there a way we can import it via npm similar to how react does it?
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
I tried these four and it didn’t work:
import numbro from 'numbro';
import {numbro} from 'numbro';
import * as numbro from 'numbro';
import 'numbro'
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
How to use an ES6 import in Node.js? - GeeksforGeeks
Introduction to ES6 import: The import statement is used to import modules that are exported by some other module. A module is a...
Read more >JavaScript modules: dynamic import() - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web ... Loading JavaScript modules dynamically using the import() syntax.
Read more >ES6 Modules and How to Use Import and Export in JavaScript
The ES2015 (ES6) edition of the JavaScript standard gives us native support for modules with the import and export syntax.
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >How can I use an ES6 import in Node.js? [duplicate]
You can also use npm package called esm which allows you to use ES6 modules in Node.js. It needs ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m having trouble getting this to work in combination with TypeScript and webpack. It might just be an issue with the TypeScript Definition file, though.
When using
import numbro from "numbro"
orimport {default as numbro} from "numbro"
:numbro
is of typeNumbroStatic
andnumbro(1000)
should worknumbro
is undefinedWhen using
import * as numbro from "numbro";
:numbro
is the whole module/package (not sure which term to use) with the 3 interfaces and the exporteddefault
listednumbro
is the function defined under Top Level Functions asnumbro = function(input) {
return ((numbro as any)(1000) as numbro.Numbro).format("0.0")
Any idea what I’m doing wrong? Or is this a bug in the Definition file?
I use
import numbro from 'numbro';
just fine with webpack + babel. What are you using to transpile your ES6?