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

Client-side assets build fails when using import aliases #5821

Closed
1 task
luiz opened this issue Jan 10, 2023 · 1 comment · Fixed by #5845
Closed
1 task

Client-side assets build fails when using import aliases #5821

luiz opened this issue Jan 10, 2023 · 1 comment · Fixed by #5845
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@luiz
Copy link

luiz commented Jan 10, 2023

What version of astro are you using?

1.9.1

Are you using an SSR adapter? If so, which one?

Node/Vercel (seems to be unrelated to a specific one)

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

When using Vite's import aliases, the application runs without problems in dev mode. However, when building the application for production and the application will generate client-side JS, a compilation problem occurs within Rollup:

> @example/[email protected] build
> astro build

18:10:14 [build] output target: server
18:10:14 [build] deploy adapter: @astrojs/vercel/serverless
18:10:14 [build] Collecting build info...
18:10:14 [build] Completed in 21ms.
18:10:14 [build] Building server entrypoints...
18:10:16 [build] Completed in 1.89s.

 building client 
Could not resolve entry module (@/components/Button.vue).
transforming (8) node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js error   Could not resolve entry module (@/components/Button.vue).
  File:
    /home/developer/dev/astro-alias-srcDir/node_modules/rollup/dist/es/shared/rollup.js:1858:30
  Code:
    1857 |     if (!(base instanceof Error))
    > 1858 |         base = Object.assign(new Error(base.message), base);
           |                              ^
      1859 |     throw base;
      1860 | }
      1861 | function augmentCodeLocation(props, pos, source, id) {
  Stacktrace:
Error: Could not resolve entry module (@/components/Button.vue).
    at error (file:///home/developer/dev/astro-alias-srcDir/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
    at ModuleLoader.loadEntryModule (file:///home/developer/dev/astro-alias-srcDir/node_modules/rollup/dist/es/shared/rollup.js:22175:20)
    at async Promise.all (index 0)

Link to Minimal Reproducible Example

https://github.com/luiz/astro-alias-srcDir

Participation

  • I am willing to submit a pull request for this issue.
@luiz luiz changed the title Client-side assets build fails when using import aliases + Astro srcDir Client-side assets build fails when using import aliases Jan 11, 2023
@natemoo-re natemoo-re added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Jan 11, 2023
@bluwy
Copy link
Member

bluwy commented Jan 13, 2023

This looks similar to #3199 and caused by rollup/plugins#1190. I'll send fix to Rollup and probably manually resolve our entries for now to temporarily workaround it.

For your project, you can also add "baseUrl": "." in the tsconfig.json to workaround it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants