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]: Yarn berry Plug'n'Play (PnP) / html-rspack-plugin: The loader ../@rsbuild/core/static/template.html didn't return html #1995

Closed
WeetA34 opened this issue Apr 3, 2024 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@WeetA34
Copy link

WeetA34 commented Apr 3, 2024

Version

System:
  OS: macOS 14.4.1
Browsers:
  Safari: 17.4.1
packages:
  devDependencies:
    @rsbuild/core: ^0.5.7
    @rsbuild/plugin-vue: ^0.5.7
    typescript: ^5.4.3
  dependencies:
    vue: ^3.4.21
packageManager: yarn@4.1.1

Details

Hello,

I'm using the standard rsbuild scaffold but I'm not able to build or dev with yarn berry in PnP mode.
I have the following error:

error   Compile error:
Failed to compile, check the errors for troubleshooting.
× Error: [html-rspack-plugin]: The loader "/Users/myuser/.yarn/berry/cache/@rsbuild-core-npm-0.5.7-9cddbe20c9-10c0.zip/node_modules/@rsbuild/core/static/template.html" didn't return html.
  │     at HtmlWebpackPlugin.evaluateCompilationResult (/Users/myuser/my-project/.yarn/__virtual__/html-rspack-plugin-virtual-782b7866ed/6/.yarn/berry/cache/html-rspack-
  │ plugin-npm-5.6.2-8fe697289d-10c0.zip/node_modules/html-rspack-plugin/index.js:530:24)
  │     at /Users/myuser/my-project/.yarn/__virtual__/html-rspack-plugin-virtual-782b7866ed/6/.yarn/berry/cache/html-rspack-plugin-npm-5.6.2-8fe697289d-10c0.zip/node_modules/
  │ html-rspack-plugin/index.js:1105:23
  │     at async Promise.all (index 2)
  │     at async Promise.all (index 1)

I have the same issue with a custom template:

$ cat rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue';

export default defineConfig({
  html: {
    template: './src/template.html',
  },
  plugins: [pluginVue()],
});

$ cat src/template.html
<!doctype html>
<html>
  <head></head>
  <body>
    <div id="<%= mountId %>"></div>
  </body>
</html>

in this case, the error message is:

error   Compile error:
Failed to compile, check the errors for troubleshooting.
× Error: [html-rspack-plugin]: The loader "/Users/myuser/my-project/src/template.html" didn't return html.
  │     at HtmlWebpackPlugin.evaluateCompilationResult (/Users/myuser/my-project/.yarn/__virtual__/html-rspack-plugin-virtual-782b7866ed/6/.yarn/berry/cache/html-rspack-
  │ plugin-npm-5.6.2-8fe697289d-10c0.zip/node_modules/html-rspack-plugin/index.js:530:24)
  │     at /Users/myuser/my-project/.yarn/__virtual__/html-rspack-plugin-virtual-782b7866ed/6/.yarn/berry/cache/html-rspack-plugin-npm-5.6.2-8fe697289d-10c0.zip/node_modules/
  │ html-rspack-plugin/index.js:1105:23
  │     at async Promise.all (index 2)
  │     at async Promise.all (index 1)

It works fine if I disable Yarn PnP by adding the following in .yarnrc.yml

nodeLinker: node-modules

Thank you

Reproduce link

see Reproduce Steps

Reproduce Steps

$ yarn create rsbuild
Input target folder
my-project
Select framework
Vue 3 (or React)
Select language
TypeScript

$ cd my-project
$ yarn set version stable
$ yarn
$ yarn build
@WeetA34 WeetA34 added the 🐞 bug Something isn't working label Apr 3, 2024
@chenjiahan
Copy link
Member

Rsbuild is currently not tested on Yarn PnP, we test and try to be compatible with it.

@chenjiahan
Copy link
Member

The build failed because Rspack does not support Yarn PnP yet, you can follow the progress here:

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