ES6 Imports?
See original GitHub issueHey! Thanks for the package. For some reason when doing import * as Timer from 'easytimer.js';
I get the error File '/project/node_modules/easytimer.js/index.d.ts' is not a module.
Any idea how to fix that? If I can get it to compile, it appears it does actually work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
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 >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 >16. Modules - Exploring JS
The imports of an ES6 module are read-only views on the exported entities. That means that the connections to variables declared inside module...
Read more >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 >A Comprehensive Look at ES6 Modules - JavaScript Tutorial
An ES6 module is a JavaScript file that executes in strict mode only. It means that any variables or functions declared in the...
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 Free
Top 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
Hi!
Finally, I solved this issue. I had to change the export of the library, so there is a breaking change in the way to import the library. I made a little migration guide with these changes: https://github.com/albert-gonzalez/easytimer.js/blob/master/MIGRATION.md.
Now you should import without any problem in ES6 or Typescript:
import Timer from 'easytimer.js
orimport { Timer } from 'easytimer.js'
The version with this fix is v3.0.0.
Best Regards!
Works fine with
import Timer from 'easytimer.js';
here.