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

feat: worker emit fileName with config #7804

Merged
merged 12 commits into from
May 12, 2022
Merged

Conversation

poyoho
Copy link
Member

@poyoho poyoho commented Apr 19, 2022

Description

fix: #7613
fix: #7928
fix: #8089

Additional context

  • this.getFilename will got a emitFile chunk’s fileName. So we can use this chunk’s fileName directly.
  • we emit file with the other chunk fileName and the fileName is exist, Rollup will call warning. And we just need to don't modify fileName, the warning will not be called. we can use the entryFileNames, chunkFileNames, assetFileNames make the file into truth path.
  • Rollup will make the same emitFile unique, we need to avoid call emitFile with same filename.
  • I found that the sourcemap file name in other places is named after the file name of the original file plus the map. Take the same plan in worker sourcemap.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@poyoho poyoho marked this pull request as draft April 19, 2022 12:13
@poyoho poyoho marked this pull request as ready for review April 19, 2022 13:37
@patak-dev patak-dev added the p2-nice-to-have Not breaking anything but nice to have (priority) label Apr 19, 2022
@patak-dev patak-dev merged commit 04c2edd into vitejs:main May 12, 2022
@poyoho poyoho deleted the fix/worker-emit branch May 13, 2022 01:40
Comment on lines +53 to +57
const workerConfig = workerOutputConfig
? Array.isArray(workerOutputConfig)
? workerOutputConfig[0] || {}
: workerOutputConfig
: {}
Copy link
Member Author

@poyoho poyoho May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I miss one point.

Array.isArray(workerOutputConfig)
        ? workerOutputConfig[0] || {}
        : workerOutputConfig

It is always using the first item. Can we limit the type just accept object? @patak-dev

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this and it makes sense in this context. We could warn if there are two output options maybe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: web workers p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
Archived in project
3 participants