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

fix: css-post/emitFile uses chunkName #9485

Closed

Conversation

yzydeveloper
Copy link
Contributor

Description

css-post/emitFile/fileName uses chunkName

Additional context

I think the file name when emitFIle must be chunkName, it can keep the uniqueness of the output asset name. For specific examples, see vite-css-post-plugin-demo

This example uses assets as input, in order to output a different style theme file


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.

@bluwy
Copy link
Member

bluwy commented Mar 2, 2023

I'm not sure if this fixes a bug, but only makes the chunk name look nicer? If there's a bug fix, can your provide tests for this?

@IGx89
Copy link

IGx89 commented Mar 2, 2023

I'm not sure if this fixes a bug, but only makes the chunk name look nicer? If there's a bug fix, can your provide tests for this?

@bluwy This likely fixes an unintentional (?) v3 change in behavior detailed in #9877. Are you able to confirm that change in behavior was indeed unintentional? If so, then if the submitter of this PR isn't still monitoring it (it's been a while) I'll gladly submit another PR with tests added. I've had to add manual logic to a lot of Vue apps working around this issue that I'd love to remove.

@yzydeveloper
Copy link
Contributor Author

I'm not sure if this fixes a bug, but only makes the chunk name look nicer? If there's a bug fix, can your provide tests for this?

Example here : https://github.com/yzydeveloper/vite-css-post-plugin-demo

@bluwy
Copy link
Member

bluwy commented Mar 3, 2023

I didn't know this PR fixes #9877 as it wasn't stated in the description, let me check the issue again. I did look at https://github.com/yzydeveloper/vite-css-post-plugin-demo but it wasn't clear what's wrong before.

@yzydeveloper
Copy link
Contributor Author

yzydeveloper commented Mar 3, 2023

I didn't know this PR fixes #9877 as it wasn't stated in the description, let me check the issue again. I did look at https://github.com/yzydeveloper/vite-css-post-plugin-demo but it wasn't clear what's wrong before.

I expect to get:

dist/assets/css/theme-default.e644798f.css
dist/assets/css/theme-black.746d0dbc.css
dist/assets/css/theme-white.5328d946.css

But actually get

image

@yzydeveloper
Copy link
Contributor Author

I didn't know this PR fixes #9877 as it wasn't stated in the description, let me check the issue again. I did look at https://github.com/yzydeveloper/vite-css-post-plugin-demo but it wasn't clear what's wrong before.

The original logic is to directly take the module path as the file name to intercept and generate the asset name. In my example, the file name is index.less. By specifying the input, I expect to output the asset name according to the input instead of using the source file name to generate.

@yzydeveloper
Copy link
Contributor Author

I didn't know this PR fixes #9877 as it wasn't stated in the description, let me check the issue again. I did look at https://github.com/yzydeveloper/vite-css-post-plugin-demo but it wasn't clear what's wrong before.

@bluwy Please see my reply #9485 (comment)

@julien-fontaine
Copy link

I'm not sure if this fixes a bug, but only makes the chunk name look nicer? If there's a bug fix, can your provide tests for this?

@bluwy I don't know if this PR fixes it, but this bug does not only make chunk name ugly (see #9877 (comment)).

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 this pull request may close these issues.

5 participants