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
When I tried to use fzf in a commonjs package, it always throws
Error [ERR_REQUIRE_ESM]: require() of ES Module xxx/node_modules/.pnpm/fzf@0.5.2/node_modules/fzf/dist/fzf.umd.js from xxx/index.js not supported.
fzf.umd.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 either rename fzf.umd.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 xxx/node_modules/.pnpm/fzf@0.5.2/node_modules/fzf/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
I've read #85, if I change my package to esm, this can be solved, but the package must finally be compiled to a cjs format.
This can be fixed if the umd format dist file is renamed to fzf.umd.cjs since "type": "module" is added at the end of package.json.
Heya! I looked at your PR and I can't say for sure if it'll be accepted. I'll have to check in other projects to know if it is an actual convention or format to have .umd.cjs as extension. This will take longer than usual as I'm occupied with other things as well.
When I tried to use fzf in a commonjs package, it always throws
I've read #85, if I change my package to esm, this can be solved, but the package must finally be compiled to a cjs format.
This can be fixed if the umd format dist file is renamed to
fzf.umd.cjs
since"type": "module"
is added at the end ofpackage.json
.changes to package.json
changes to vite-legacy.config.ts
The text was updated successfully, but these errors were encountered: