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

Worker scripts not output in correct assets directory #10626

Closed
1 task done
nerdoza opened this issue Apr 1, 2024 · 3 comments · Fixed by #10732
Closed
1 task done

Worker scripts not output in correct assets directory #10626

nerdoza opened this issue Apr 1, 2024 · 3 comments · Fixed by #10732
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: astro Related to the core `astro` package (scope)

Comments

@nerdoza
Copy link
Contributor

nerdoza commented Apr 1, 2024

Astro Info

Astro                    v4.5.12
Node                     v18.18.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

The Astro build is picking up the Worker script file and transforming it and placing it in the dist directory during builds, but it is always placed in dist/assets regardless of what the build.assets configuration is set to.

What's the expected result?

I would expect the worker script to be output to the same directory as other client scripts as specified by the build.assets property in the configuration.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-knx6rb?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 1, 2024
@lilnasy lilnasy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Apr 1, 2024
@rishi-raj-jain
Copy link
Contributor

I'd love to work on this. May someone guide me the entrypoint where we bundle the workers in the core?

@bluwy
Copy link
Member

bluwy commented Apr 8, 2024

Worker builds is handled by Vite and the output code is here: https://github.com/vitejs/vite/blob/e2658ad6fe81278069d75d0b3b9c260c3021b922/packages/vite/src/node/plugins/worker.ts#L89-L106

It doesn't seem like Astro sets the vite.build.assetsDir and is probably why build.assets has no effect. I'm not sure why Astro didn't set this for a long time and I'm not sure of the impact if we set it now though. (probably fine i hope)

@ematipico ematipico added the pkg: astro Related to the core `astro` package (scope) label Apr 9, 2024
@rishi-raj-jain
Copy link
Contributor

Thank you @bluwy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants