opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
42 stars 0 forks source link

Paraglide: Output `.mjs` instead of `.js` #24

Closed LorisSigrist closed 6 months ago

LorisSigrist commented 6 months ago

Currently, if you can't use Paraglide in a CJS project, since it will wrongly interpret paraglide's .js files as CJS. If we switch the extension to .mjs it should always work.

This may be a breaking change

samuelstroschein commented 6 months ago

This is a breaking change. Existing node16 imports ending with .js won't work anymore.

I also do not like this change because it's node-specific. ECMAScript contains no spec about .mjs. I could live with a config option mjsFileExtension but strongly advocate against deviating from ECMAScript.

LorisSigrist commented 6 months ago

ECMAScript doesn't specify a file extension, since they are meaningless on the web anyway. Browsers only care about the mime-type. I'm also not aware of any build tool that doesn't support .mjs extensions.

We do need something like this, otherwise it's impossible to use paraglide's output from a CJS environment. A config option could be a good way to go.

linear[bot] commented 6 months ago

PARJS-27 Paraglide: Output `.mjs` instead of `.js`