You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
internal/modules/cjs/loader.js:1102
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/myprogram/node_modules/d3-time-format/src/index.js
require() of ES modules is not supported.
require() of /path/to/myprogram/node_modules/d3-time-format/src/index.js from /path/to/myprogram/myprogram.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /path/to/myprogram/node_modules/d3-time-format/package.json.
Could you restore support for using require(...) syntax instead of requiring import ... syntax? Note that developers can still opt to use import ... syntax if they like, this would just restore support for require(...) which is quite convenient when quickly writing utility scripts.
The text was updated successfully, but these errors were encountered:
I deliberately dropped support for CJS. I have no interest in maintaining multiple module formats and encourage everyone to adopt ES modules. If you disagree, you are free to fork this module, to use an earlier version, or simply to not use it. Thank you for your feedback.
Starting with version 4.0.0, it is not possible to import
d3-time-format
in a script usingrequire()
syntax, for example:The error is:
Could you restore support for using
require(...)
syntax instead of requiringimport ...
syntax? Note that developers can still opt to useimport ...
syntax if they like, this would just restore support forrequire(...)
which is quite convenient when quickly writing utility scripts.The text was updated successfully, but these errors were encountered: