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

Astro throws ESM import error #6

Closed
mayank99 opened this issue Sep 6, 2022 · 1 comment
Closed

Astro throws ESM import error #6

mayank99 opened this issue Sep 6, 2022 · 1 comment

Comments

@mayank99
Copy link

mayank99 commented Sep 6, 2022

Getting this error when following astro instructions:

$ astro dev
<project>/node_modules/@whyframe/astro/src/index.js:2
import { createFilter } from 'vite'
         ^^^^^^^^^^^^
SyntaxError: Named export 'createFilter' not found. The requested module 'vite' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
 
import pkg from 'vite';
const { createFilter } = pkg;
 
at ModuleJob._instantiate (node:internal/modules/esm/module_job:127:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:193:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
error Command failed with exit code 1.

using this astro.config.ts (also the same using .mjs):

export default defineConfig({
  integrations: [
    react(),
  ],
  vite: {
    plugins: [
      whyframe({ defaultSrc: '/frames/default' }),
      whyframeAstro({ defaultFramework: 'react' }),
    ],
  },
});

with the following package versions:

"@astrojs/react": "^1.1.1",
"@whyframe/core": "^0.1.3",
"@whyframe/astro": "^0.1.1",
"astro": "^1.1.5",
"react": "^18.0.0",
"react-dom": "^18.0.0",

I've tried using the default import and destructuring that, but I still get the same error.

@mayank99
Copy link
Author

mayank99 commented Sep 6, 2022

Actually, nevermind. I was unable to create a minimal repro, when I realized that this is happening because I have vite 2 and vite 3 conflicting in my monorepo. Apologies!

@mayank99 mayank99 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
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