construct-style-sheets
construct-style-sheets copied to clipboard
chore: set type to module in package.json
The type
property of package.json
may be used by frontend tooling (e.g Webpack, Vite) in determining whether the package's entry point is a CJS or ES module. If no property is specified, the entry point may be treated as a CJS module. As an illustration, here is a warning that Vite shows when you import the construct-style-sheets polyfill:
construct-style-sheets-polyfill doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.
This PR explicitly sets the type
property to module
to avoid possible misinterpretation.
Related to https://github.com/vaadin/flow/issues/12574
Unfortunately, that doesn't seem possible since it breaks all the configuration for Rollup and Karma. While Rollup can be fixed by migrating to ES2015+, Karma doesn't allow it since it doesn't support ESM.
The only choice I can see is to provide additional .mjs
file that is described in exports
field of package.json
. That would fix the Vite issue (and issue for all the modern development stack) along with preserving the current configuration.
I'm going to take care of it.