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

Rollup failed to resolve import #10

Closed
zAlweNy26 opened this issue Nov 13, 2022 · 5 comments · Fixed by #22
Closed

Rollup failed to resolve import #10

zAlweNy26 opened this issue Nov 13, 2022 · 5 comments · Fixed by #22

Comments

@zAlweNy26
Copy link

zAlweNy26 commented Nov 13, 2022

Hi, I'm trying to build for production, but I get this error when I do astro check && tsc --noEmit && astro build:

[vite]: Rollup failed to resolve import "C:UsersdanynDocumentsGitHubexplorershandbook
ode_modules@matthewpastro-fastifylibserver.js" from "@astrojs-ssr-virtual-entry".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

I did what he said:

vite: {
  build: {
    rollupOptions: {
      external: fileURLToPath(new URL('node_modules/@matthewp/astro-fastify/lib/server.js', import.meta.url))
    }
  }
}

But I still get the error.

@matthewp
Copy link
Owner

@zAlweNy26 That's an odd one. I assume this is a windows resolution issue. I'll take a look. This happens with astro build and not with astro check, I presume?

@zAlweNy26
Copy link
Author

zAlweNy26 commented Nov 14, 2022

Yes, I am using Windows 11, nothing to do with astro check, just a astro build issue.

@espimarisa
Copy link

Hey @matthewp, I can confirm that this is still an issue today - on Windows 10 22H2, pnpm 8.0.0, and Node v20. Running v2.1.5 of the package.

Does not happen with astro check, only happens with astro build. I get the same exact type of error, and adding the path to external does nothing to fix the issue.

Definitely worth looking into, seems like a pretty big roadblock currently.

@matthewp
Copy link
Owner

Would love a PR if anyone has time to look at this themselves.

@SapphicMoe
Copy link
Contributor

SapphicMoe commented Jul 25, 2023

@matthewp I figured out why this is happening. I solved this by appending double forward slashes to the path.

I have submitted a PR to fix this issue:
#22

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

Successfully merging a pull request may close this issue.

4 participants