After switching from CRA to Vite on a big project, I got a cryptic error: fje.has" is not a function. After tracking down the bug, I found that it was caused by this line in plur:
Object.defineProperty(module, 'exports', {
get() {
return new Map(Object.entries(irregularPlurals));
}
});
This gets minified as an empty object export by both esbuild and terser (I've tried both). Thus the error.
I saw here that you put the responsibility on Vite: https://github.com/sindresorhus/plur/issues/32
I believe this has nothing to do with Vite as it would happen with anyone using just esbuild or terser.
This is also the only package that causes this, and I have thousands in this project, counting dependencies of dependencies. Getting rid of plur (thus irregular-plurals) just made the whole app work.
Hello,
After switching from CRA to Vite on a big project, I got a cryptic error:
fje.has" is not a function
. After tracking down the bug, I found that it was caused by this line inplur
:https://github.com/sindresorhus/plur/blob/main/index.js#L8
irregularPlurals
is of course a direct import from this package:https://github.com/sindresorhus/irregular-plurals/blob/main/index.js#L5-L9
This gets minified as an empty object export by both esbuild and terser (I've tried both). Thus the error.
I saw here that you put the responsibility on Vite: https://github.com/sindresorhus/plur/issues/32 I believe this has nothing to do with Vite as it would happen with anyone using just esbuild or terser. This is also the only package that causes this, and I have thousands in this project, counting dependencies of dependencies. Getting rid of
plur
(thusirregular-plurals
) just made the whole app work.