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.

ES6 / JS modules example

See original GitHub issue

Is there a way to implement this in ES6 browser processed modules? Trying:

import * as CountUp from 'countup.js'

and getting:

Uncaught ReferenceError: exports is not defined at countUp.min.js:11

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
btoprocommented, Mar 14, 2019

excellent that worked thank you! next release of the polymer 3 element will use this directly 😃

1reaction
inorganikcommented, Mar 14, 2019

That’s awesome, thanks for working on it! Since I re-wrote CountUp in typescript, the modules have been a HUGE headache. (Issue thread) Before 2.X, I used gulp-umd-wrapper which produced a UMD module and globally scoped CountUp which is very compatible for everyone… Typescript wrapped UMD module does not make CountUp global, which makes bad compatibility, especially with Webpack.

So I released again with an AMD wrapper, it seemed to be compatible with both requirejs and Webpack. But people still had issues. So I released again with commonjs module wrapping. I found it works well with Browserify and Webpack.

I did some tests and was able to use es6 export successfully with vanilla js and webpack. Perhaps I’ll issue another release…

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module ... These examples demonstrate a simple set of modules that...
Read more >
ES6 - Modules - Tutorialspoint
A module is nothing more than a chunk of JavaScript code written in a file. By default, variables and functions of a module...
Read more >
A Practical guide to ES6 modules - freeCodeCamp
JavaScript has had modules for a long time. However, they were implemented via libraries, not built into the language. ES6 is the first...
Read more >
16. Modules - Exploring JS
ES6 modules are stored in files. There is exactly one module per file and one file per module. You have two ways of...
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 >

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