countUp.js: Webpack: "require function is used in a way in which dependencies cannot be statically extracted"
[X] Bug
CountUp.js version: v2.0.0
Description
- Building the application with webpack, I get the following warning in the output logs:
WARNING in ./node_modules/countUp.js/dist/countUp.min.js 1:328-335 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (10 by maintainers)
@CPelletier I got this error from ESLint and fixed it after adding ignore rule for whole file. But after install version 2.0.1 it just works good without any errors
In that case I would like to change the module wrapping to AMD and cut another release. Although we know commonjs works well with webpack, it’s a node module wrapper and not optimized for browser usage… I was not able to use it in my demo with just requirejs. I’m sure if I googled and troubleshooted long enough I’d eventually figure out a way but it shouldn’t be that hard for everyone else. AMD works well with just requirejs; in fact requirejs recommends AMD. So if it’s compatible with webpack lets go with AMD. I’ll close after I release with AMD.
It still works with
amd. The only one thing - I had to exclude countUp.js from ESLint, because it produces error:../../countUp.js 12:1 error 'define' is not defined no-undefBut it could be a problem from my side.