ITADN

ESM only

#237Openpcfreak30 创建于 2025-01-18
pending response
P
pcfreak30commented
I have been trying to use this with `vite/5.4.9` and there seems to be some weird quirks around ESM. I have also tested vite 6. I would request a transition to ESM only `"type":"module"` in a new semver and drop the `dist` folder too in all packages. I am having to do ``` resolve: { alias: { // Use the ESM version specifically "robot3": path.resolve(__dirname, "../../node_modules/robot3/machine.js"), "react-robot": path.resolve( __dirname, "../../node_modules/react-robot/machine.js", ), }, }, ``` ``` commonjs({ filter(id) { return ( id.includes("url") || id.includes("robot3") || id.includes("react-robot") ); }, }), ``` ``` optimizeDeps: { include: ["robot3", "robot3/debug", "react-robot"], }, ``` And I would prefer not to do such awkward vite configs. Alternative you can do in all packages, only (remove main/module) ``` "type":"module", "main": "machine.js", ``` and rely on exports for everything in-case any tooling wants to act differently. The whole standard is a mess to begin with, but this works with vite.
4 条评论