-
-
Notifications
You must be signed in to change notification settings - Fork 752
Open
Description
Version
System:
OS: Linux 6.14 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
Memory: 30.50 GB / 62.47 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Browsers:
Chrome: 142.0.7444.175
Firefox: 145.0.2
Firefox Developer Edition: 145.0.2
npmPackages:
@rsbuild/core: ~1.7.2 => 1.7.2
@rsbuild/plugin-react: ~1.4.2 => 1.4.2
@rsbuild/plugin-sass: ~1.4.0 => 1.4.0
@rsbuild/plugin-type-check: ~1.3.2 => 1.3.2Details
At the moment I'm aliasing { vm: 'vm-browserify' }. Default configuration of Biome forces me to replace vm with node:vm. Unfortunately, Rsbuild breaks the build and gives me only two solutions:
Solution: Check if you need to import Node.js module.
- If not needed, remove the import.
- If needed, use "@rsbuild/plugin-node-polyfill" to polyfill it. (See https://npmjs.com/package/@rsbuild/plugin-node-polyfill)
I can't remove this import, and @rsbuild/plugin-node-polyfill has too many dependencies for my needs. It should be possible to alias all imports regardless of origin, so { 'node:vm': 'vm-browserify' } should work.
Reproduce link
Reproduce Steps
An example which should work with { 'node:vm': 'vm-browserify' } in resolve.alias
import vm from 'node:vm';
// Create a context object
const context = { value: 10 }
vm.createContext(context)
// Compile then run
const script = new vm.Script('value *= 2')
script.runInNewContext(context)
console.log(context.value) // 20Metadata
Metadata
Assignees
Labels
No labels