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
Currently all the output files are using the .js extension. This is an issue because if the package.json file has "type": "module", then all the cjs/*.js imports error with the error:
require() of ES Module <file>.js from <file>.cjs not supported.
index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in <path>/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
And, I suspect that the reverse is true as well (trying to import from a package without "type": "module"), though I haven't verified it.
In order to properly support these imports could you please either:
switch based on the package.json's "type":
with "type": "module", CommonJS files end in .cjs and ESM files end in .js
without "type": "module", CommonJS files end in .js and ESM files end in .mjs
or just always have all CommonJS files end in .cjs and all ESM files end in .mjs
The better way to handle this is to use the exports and main fields in package.json instead of using more file extensions that may not be supported in the future.
Currently all the output files are using the
.js
extension. This is an issue because if the package.json file has"type": "module"
, then all thecjs/*.js
imports error with the error:And, I suspect that the reverse is true as well (trying to
import
from a package without"type": "module"
), though I haven't verified it.In order to properly support these imports could you please either:
"type"
:"type": "module"
, CommonJS files end in.cjs
and ESM files end in.js
"type": "module"
, CommonJS files end in.js
and ESM files end in.mjs
.cjs
and all ESM files end in.mjs
I believe this is the cause of solidjs-community/solid-aria#75.
The text was updated successfully, but these errors were encountered: