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
./dist/esm/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. ./dist/esm/index.mjs (More info) - this is breaking the library for users in SvelteKit/Vites, so it would be nice to see if be an error
Also, the one about "types" needing to come first in exports to satisfy TypeScript. I've never actually seen that break an app, so I wonder if it should be a warning?
The text was updated successfully, but these errors were encountered:
Escalating the written in ESM... message as an error makes sense to me. Initially I have it as a warning because the library may not be meant for normal nodejs usage, but I think it's rare these days and is always worth aligning the node default. Might be safer to only change this in the next minor.
I think the types message still makes sense as an error. Because it implies an intention for types to work, but it'll never work in practice. Warnings are reserved for things that still may work in certain environments.
I've been thinking of implementing this in the next breaking minor, but I'd feel more comfortable landing this once #19 is resolved. If we emit an error for a browser-only library, there's not much they can do other than adding "type": "module" or use .mjs (or the other way round for CJS). And both choice isn't really necessary for a browser-only library to make.
If we can safely infer the environment it's meant for, this should emit an error for Node.js and not emit anything for browser. (Plus we can detect usage of CJS for browsers which would be the bigger culprit). So I think I'll punt this off for later for now.
bluwy
changed the title
Upgrade warning to error
Emit error for files with invalid formats
Jan 6, 2025
https://publint.dev/@growthbook/[email protected]
./dist/esm/index.js is written in ESM, but is interpreted as CJS. Consider using the .mjs extension, e.g. ./dist/esm/index.mjs (More info) - this is breaking the library for users in SvelteKit/Vites, so it would be nice to see if be an error
Also, the one about "types" needing to come first in exports to satisfy TypeScript. I've never actually seen that break an app, so I wonder if it should be a warning?
The text was updated successfully, but these errors were encountered: