Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM only #237

Open
pcfreak30 opened this issue Jan 18, 2025 · 0 comments
Open

ESM only #237

pcfreak30 opened this issue Jan 18, 2025 · 0 comments

Comments

@pcfreak30
Copy link

pcfreak30 commented Jan 18, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant