rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Feature] Should not generate facade `.js` files for CSS chunks

Open ICJR opened this issue 2 years ago • 18 comments

System Info

System: OS: Windows 10 10.0.19045 CPU: (12) x64 Intel(R) Core(TM) i7 Memory: 20.73 GB / 31.91 GB Binaries: Node: 18.12.0 - C:\Program Files\n npm: 9.2.0 - C:\Program Files\node Browsers: Edge: Spartan (44.19041.1266.0), C Internet Explorer: 11.0.19041.1566

Details

  • Upgraded to 0.2.3
  • Read documentation around output.filename no longer supporting [ext]
  • Created appropriate output values filename, cssFilename, etc.
  • Bundle now creates an empty js file when I bundle css files using builtin sass loader

Reproduce link

No response

Reproduce Steps

Bundle sass files using 0.2.3

ICJR avatar Jun 21 '23 23:06 ICJR

Thanks for reporting. I'd like to take a look at this. Please provide a reproduction repo using https://github.com/web-infra-dev/rspack-repro.

hyf0 avatar Jun 22 '23 04:06 hyf0

@hyf0 https://github.com/ICJR/rspack-repro

I noticed the empty js file is kept whenever I use the dynamic filename variables. I was using [contenthash] for my own project but this repo uses [name] and it runs into the same issue. ( webpack 5+ requires webpack-remove-empty-scripts to remove empty scripts.

Side question: In the previous version of rspack if I used [contenthash][ext] it would bundle using the entry path + content hash + extension. Is there a method to easily replicate that in the latest version?

ICJR avatar Jun 22 '23 10:06 ICJR

Side question: In the previous version of rspack if I used [contenthash][ext] it would bundle using the entry path + content hash + extension. Is there a method to easily replicate that in the latest version?

See details at https://www.rspack.dev/blog/announcing-0.2.html#breaking-changes and https://github.com/web-infra-dev/rspack/issues/3270.

hyf0 avatar Jun 22 '23 12:06 hyf0

Is this file the empty file that you refer to?

If it is, the js file is generated expectedly under the current CSS implementation of Rspack.

Webpack won't emit the js file. It's a known difference and we plan to align with Webpack in the future.

hyf0 avatar Jun 22 '23 12:06 hyf0

That's the correct file, is my only option to revert to the older rspack version in the meantime?

ICJR avatar Jun 23 '23 00:06 ICJR

That's the correct file, is my only option to revert to the older rspack version in the meantime?

I'm not sure how the old version behaves. But the current behavior is expected and correct.

My suggestion is to use the current version. It's not a bug.

I won't close this issue now. As I said before, we will align our CSS implementation with Webpack5 in the near future, then it will solve this issue.

hyf0 avatar Jun 24 '23 14:06 hyf0

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Aug 23 '23 14:08 stale[bot]

@hyf0 is this fixed?

hardfist avatar Aug 24 '23 03:08 hardfist

@hyf0 is this fixed?

This is a alignment feature rather than a bug. The alignment hasn't been made.

hyf0 avatar Aug 24 '23 03:08 hyf0

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Dec 15 '23 16:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Jun 11 '24 04:06 stale[bot]

I would also like to have this alignment.

MuTsunTsai avatar Jun 19 '24 03:06 MuTsunTsai

Duplicated with https://github.com/web-infra-dev/rspack/issues/5096, so I will close this issue, please discuess there

LingyuCoder avatar Jul 19 '24 10:07 LingyuCoder

I fail to see how this is a duplicate with #5096, especially since rspack has switched to another CSS plugin in the meantime.

Could this be reopened?

runiq avatar Dec 23 '24 16:12 runiq

Yes, this issue should reopen as webpack and Rspack both switch to new algorithm to deal with css since #8534. And we are trying to solve this

JSerFeng avatar Dec 25 '24 05:12 JSerFeng

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Feb 23 '25 06:02 stale[bot]

bump

runiq avatar Feb 23 '25 09:02 runiq

bump

JSerFeng avatar Feb 25 '25 11:02 JSerFeng