-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Culori ESM import throws an error in Next.js production build #195
Comments
Hi @VojtechVidra! What seems to be going on is some unintended tree-shaking of the ESM entry point Importing just import { converter } from "culori"; If instead you import the LCh converter directly, which is defined as a side-effect in the entry point, all the other side effects are executed and the code works: import { lch } from 'culori';
This is not a problem for the CommonJS bundle because tree-shaking is not applicable there. |
The issue may be caused by our usage of |
I confirm this. Same thing happens when creating a build with Svelte. I manually removed "sideEffects": false, from the package.json of culori and the build works fine afterwards. |
In Tested the files in |
I just updated to 3.1.2 and can confirm the build is working as expected in a Svelte app. |
Hi Dan Burzo!
I've encountered strange issue when using latest culori with Next.js in production build only. I've created minimal reproduction of the issue (see the repo below).
How to reproduce
Dev
If you run the app with
npm run dev
command it works as expected, the converter converts the color with no problem in both theculori
andculori/require
usage.Prod
However if you run the production build
npm run build && npm run start
theculori
ESM version throws an error but theculori/require
version still works as expected.https://github.com/VojtechVidra/nextjs-culori
I'm not sure if this is an issue with Culori or Next.js, but I've figured I'll ask you first.
Thanks for creating this great package!
The text was updated successfully, but these errors were encountered: