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]: Compilation errors occur when using @vanilla-extract/css with @vanilla-extract/sprinkles #3562

Closed
raamkey opened this issue Sep 25, 2024 · 1 comment · Fixed by #3575
Labels
🐞 bug Something isn't working

Comments

@raamkey
Copy link

raamkey commented Sep 25, 2024

Version

System:
    OS: macOS 15.0
    CPU: (8) arm64 Apple M1 Pro
    Memory: 133.89 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 129.0.6668.59
    Safari: 18.0
  npmPackages:
    @rsbuild/core: 1.0.5 => 1.0.5 
    @rsbuild/plugin-react: 1.0.2 => 1.0.2

Details

working fine without @vanilla-extract/sprinkles. after integrating with @vanilla-extract/sprinkles getting below compile error

`

[email protected] dev /Users/ramki/Work/poc/vanilla-extract
rsbuild dev --open

Rsbuild v1.0.7

Local: http://localhost:3000/
Network: http://192.168.29.92:3000/
Network: http://10.64.8.3:3000/

start Compiling...
/Users/ramki/Work/poc/vanilla-extract/src/App.css.ts:45
$ReactRefreshRuntime$.refresh(module.id, module.hot);
^

ReferenceError: $ReactRefreshRuntime$ is not defined
at /Users/ramki/Work/poc/vanilla-extract/src/App.css.ts:45:3

Node.js v20.10.0
 ELIFECYCLE  Command failed with exit code 1.
`

Reproduce link

https://github.com/raamkey/vanilla-extract

Reproduce Steps

  1. execute pnpm install and pnpm dev
  2. find the error message in the console
@raamkey raamkey added the 🐞 bug Something isn't working label Sep 25, 2024
@chenjiahan
Copy link
Member

It looks like @vanilla-extract/sprinkles generates some modules in node_modules that conflict with react-refresh . Excluding these modules avoids the exception.

export default defineConfig({
  plugins: [
    pluginReact({
      reactRefreshOptions: {
        exclude: [
          /\.css\.ts$/,
+         /node_modules\/@vanilla-extract/,
        ],
      },
    }),
  ],
  tools: {
    rspack: {
      plugins: [new VanillaExtractPlugin()],
    },
  },
});

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.

2 participants