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]: html-rspack-plugin child compilation fail when used with case-sensitive-paths-webpack-plugin #7193

Closed
matteom-synth opened this issue Jul 16, 2024 · 2 comments · Fixed by #7200
Assignees
Labels
bug Something isn't working

Comments

@matteom-synth
Copy link

matteom-synth commented Jul 16, 2024

Version

System:
    OS: macOS 14.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 195.86 MB / 36.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Browsers:
    Chrome: 126.0.6478.127
    Safari: 17.5
  npmPackages:
    @rsbuild/core: 1.0.1-beta.2 => 1.0.1-beta.2
    @rsbuild/plugin-react: 1.0.1-beta.2 => 1.0.1-beta.2

Details

Hi! In @rsbuild/core@1.0.1-beta.2 the Webpack plugin case-sensitive-paths-webpack-plugin (that it's part of the list of "compatible" plugins -- https://www.rspack.dev/guide/compatibility/examples) doesn't work if html.template is being set in the rsbuild config. Everything was working fine in 1.0.1-beta.1.
The issue seems to happen only when html.template. If it's not set, the build works fine. I'm not sure if the issue is happening because of case-sensitive-paths-webpack-plugin specifically or because of some new issues withing the plugin system interop.

I'm attaching a minimal repo (boostrapped by running npm create rsbuild@latest, adding case-sensitive-paths-webpack-plugin, and adding a html.template.

Output:

start   Compiling...
error   Compile error:
Failed to compile, check the errors for troubleshooting.
× Error: [html-rspack-plugin]: Child compilation failed:
  │   × Module build failed:
  │   ├─▶   ×   × Expression expected
  │   │     │    ╭─[data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;:1:1]
  │   │     │  1 │ __webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ddata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;:data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;edata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;xdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;/data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;jdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;vdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;sdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;rdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;idata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;,data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;wdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;edata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;kdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;udata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ldata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;idata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;hdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath; data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;=data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath; data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;wdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;edata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;kdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;sdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;edata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;udata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;rdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;idata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;_data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath; data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;=data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath; data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;hdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;mdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ldata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;Wdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;edata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;kdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;Pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ldata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;udata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;gdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;idata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ndata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;Pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;udata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;bdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;ldata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;idata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;cdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;Pdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;adata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;tdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;hdata:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;;data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;
  │   │     │    ·                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ─
  │   │     │    ╰────
  │   │     │
  │   │
  │   ╰─▶ Syntax Error
  │
  │     at /Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rsbuild+core@1.0.1-beta.2/node_modules/@rsbuild/core/compiled/html-rspack-plugin/index.js:435:24
  │     at finalCallback (/Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+core@1.0.0-alpha.4_@swc+helpers@0.5.11/node_modules/@rspack/core/dist/Compiler.js:348:17)
  │     at /Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+core@1.0.0-alpha.4_@swc+helpers@0.5.11/node_modules/@rspack/core/dist/Compiler.js:375:20
  │     at /Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+core@1.0.0-alpha.4_@swc+helpers@0.5.11/node_modules/@rspack/core/dist/Compiler.js:470:28
  │     at done (/Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+lite-tapable@1.0.0-alpha.4/node_modules/@rspack/lite-tapable/dist/index.js:478:13)
  │     at AsyncSeriesHook.callAsyncStageRange (/Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+lite-tapable@1.0.0-alpha.4/node_modules/@rspack/lite-tapable/dist/index.js:485:20)
  │     at AsyncSeriesHook.callAsync (/Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+lite-tapable@1.0.0-alpha.4/node_modules/@rspack/lite-tapable/dist/index.js:88:21)
  │     at /Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+core@1.0.0-alpha.4_@swc+helpers@0.5.11/node_modules/@rspack/core/dist/Compiler.js:466:41
  │     at /Users/matteo.mazzarolo/workspace/rsbuild-repro/node_modules/.pnpm/@rspack+core@1.0.0-alpha.4_@swc+helpers@0.5.11/node_modules/@rspack/core/dist/Compiler.js:533:23

Reproduce link

https://github.com/matteom-synth/rsbuild-issue-repro-1

Reproduce Steps

  1. Clone
  2. Run pnpm i
  3. Run pnpm dev
@chenjiahan chenjiahan transferred this issue from web-infra-dev/rsbuild Jul 16, 2024
@chenjiahan
Copy link
Member

This issue was introduced in @rspack/core 1.0.0-alpha.4.

@ahabhgk can you check this? This plugins uses the nmf.hooks.afterResolve hook

@chenjiahan chenjiahan added the bug Something isn't working label Jul 16, 2024
@chenjiahan
Copy link
Member

chenjiahan commented Jul 17, 2024

Reproduced the same error when using Rspack v1.0.0-alpha.4 with storybook-react-rsbuild:

image

  1. https://github.com/rspack-contrib/rsfamily-doc-ui
  2. bump Rsbuild 1.0.1-beta.2 (it is based on Rspack v1.0.0-alpha.4)
  3. pnpm dev

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

Successfully merging a pull request may close this issue.

3 participants