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
In our project we build a watch mode in which we run node build/watch.js and in there run const loadConfigFile = require('rollup/dist/loadConfigFile'); among other things. This has worked for years, and while the convention in ESM code is to include an extension, in CJS it tends to have been omitted.
Actual Behaviour
In the last release, this seems to have stopped working. We now get an ESM error.. from a CJS import in a CJS file.
Uncaught Error: Cannot find module '/qunit/node_modules/rollup/dist/loadConfigFile'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:916:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:909:15)
at resolveExports (internal/modules/cjs/loader.js:449:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:489:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
I've not included a test case as I believe this issue is already understood and discussed at #4436 and #4443. However that's quite burried and I'm hoping this will help others to find the issue quicker and avoid further duplicate reports.
The short-term workaround is to include .js in your require statement, or pin to an older version of Rollup.
After updating from rollup 2.56.3 to 2.70.1, this broke because
upstream maps the extension-less variant to ESM. This will hopefully
be fixed soon, but is easy enough to workaround in the interim.
Workaround upstream rollup/rollup#4460.
Thanks your for the issue. I fear we will need to leave it as such (i.e. you need to add the extension) until the next major version (and may be beyond that?) because that is the only way to maintain compatibility with latest Node, there have been many discussions and previously we were using a deprecated exports pattern that is no longer supported in latest Node.
Rollup Version
2.70.1
Operating System (or Browser)
Linux
Node Version (if applicable)
v14.17.5
Link To Reproduction
N/A
Expected Behaviour
In our project we build a watch mode in which we run
node build/watch.js
and in there runconst loadConfigFile = require('rollup/dist/loadConfigFile');
among other things. This has worked for years, and while the convention in ESM code is to include an extension, in CJS it tends to have been omitted.Actual Behaviour
In the last release, this seems to have stopped working. We now get an ESM error.. from a CJS import in a CJS file.
I've not included a test case as I believe this issue is already understood and discussed at #4436 and #4443. However that's quite burried and I'm hoping this will help others to find the issue quicker and avoid further duplicate reports.
The short-term workaround is to include
.js
in your require statement, or pin to an older version of Rollup.The text was updated successfully, but these errors were encountered: