Open vursen opened 2 years ago
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.
The
type
property ofpackage.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:This PR explicitly sets the
type
property tomodule
to avoid possible misinterpretation.Related to https://github.com/vaadin/flow/issues/12574