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 support #17

Open
UberMouse opened this issue Sep 18, 2022 · 2 comments
Open

ESM support #17

UberMouse opened this issue Sep 18, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@UberMouse
Copy link
Collaborator

Currently only CJS style code is shipped. Update package to ship ESM and CJS code and update package.json with ESM functionality

@UberMouse UberMouse added the enhancement New feature or request label Sep 22, 2022
@mingfang
Copy link

mingfang commented Dec 7, 2022

I'm trying to use xstate-tree with Astro and am getting this error.

@koordinates/xstate-tree 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.

The workaround is to add this to astro.config.mjs

export default defineConfig({
  // ...the rest of your config, and then this
  vite: {
    ssr: {
      noExternal: ['@koordinates/xstate-tree'],
    }
  },
});

@UberMouse
Copy link
Collaborator Author

Hey Ming,

Just letting you know I have seen this, not sure when I will get a chance to look at it. This all stems from the fact it was pulled out of our monorepo which emits ES2020 but doesn't use ESM because of other problems, so we run babel over all our internal packages.

I think I'll have some time to resolve this over the holidays.

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

No branches or pull requests

2 participants