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

[Bug]: How to use static resources in HTML #8844

Open
kailong321200875 opened this issue Dec 25, 2024 · 1 comment
Open

[Bug]: How to use static resources in HTML #8844

kailong321200875 opened this issue Dec 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kailong321200875
Copy link

kailong321200875 commented Dec 25, 2024

System Info

System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 1.24 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 18.18.0 - ~/.volta/tools/image/node/18.18.0/bin/node
Yarn: 1.22.18 - ~/.volta/bin/yarn
npm: 9.8.1 - ~/.volta/tools/image/node/18.18.0/bin/npm
pnpm: 9.6.0 - ~/.volta/bin/pnpm
Browsers:
Chrome: 128.0.6613.138
Safari: 15.6.1
npmPackages:
@rspack/cli: ^1.1.8 => 1.1.8
@rspack/core: ^1.1.8 => 1.1.8

Details

The same configuration can run perfectly in webpack 5, but it is always ineffective in rspack

webpack5:
Image
Image
Image

rspack:
Image
Image
Image

After testing, use html-webpack-plugin instead of rspack Is there a problem with the implementation of rspack.HtmlRspackPlugin as it can display normally?

Reproduce link

https://github.com/kailong321200875/rspack-html-cli

Reproduce Steps

npm run dev

@kailong321200875 kailong321200875 added bug Something isn't working pending triage The issue/PR is currently untouched. labels Dec 25, 2024
@LingyuCoder
Copy link
Contributor

Currently, the HtmlRspackPlugin does not recognize the resolve.alias in the rspack.config.js file, because Rspack will not start a child compiler to process the html file. You need to manually copy the image resources to the output.path directory through the CopyRspackPlugin.

And also, you can use html-webpack-plugin directly, it works well with Rspack.

@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants