Closed RoyRao2333 closed 1 month ago
System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Memory: 1.29 GB / 16.00 GB Shell: 5.9 - /bin/zsh Browsers: Safari: 17.5 npmPackages: @rsbuild/core: 1.0.1 => 1.0.1 @rsbuild/plugin-less: 1.0.1 => 1.0.1 @rsbuild/plugin-react: 1.0.1 => 1.0.1 @rsbuild/plugin-svgr: 1.0.1 => 1.0.1
// rsbuild.config.ts import { defineConfig } from '@rsbuild/core'; import { pluginLess } from '@rsbuild/plugin-less'; import { pluginReact } from '@rsbuild/plugin-react'; import { pluginSvgr } from '@rsbuild/plugin-svgr'; export default defineConfig({ plugins: [pluginReact(), pluginSvgr(), pluginLess()], tools: { rspack: { node: { global: true, }, }, }, });
// App.tsx import process from 'node:process'; console.log(process.env.DEV);
I get error:
See codes above
API from node cannot be used in the browser environment
@SoonIter
If so, what's the point of turning on polyfills for Node?
Try this plugin: https://github.com/rspack-contrib/rsbuild-plugin-node-polyfill
Version
Details
I get error:
Reproduce link
See codes above
Reproduce Steps
See codes above