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]: You may need an additional plugin to handle "node:" URIs. #3567

Closed
RoyRao2333 opened this issue Sep 26, 2024 · 3 comments · Fixed by #3571
Closed

[Bug]: You may need an additional plugin to handle "node:" URIs. #3567

RoyRao2333 opened this issue Sep 26, 2024 · 3 comments · Fixed by #3571
Assignees
Labels
🐞 bug Something isn't working

Comments

@RoyRao2333
Copy link

Version

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

Details

// 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:

image

Reproduce link

See codes above

Reproduce Steps

See codes above

@RoyRao2333 RoyRao2333 added the 🐞 bug Something isn't working label Sep 26, 2024
@SoonIter
Copy link
Member

API from node cannot be used in the browser environment

@RoyRao2333
Copy link
Author

@SoonIter

If so, what's the point of turning on polyfills for Node?

@chenjiahan
Copy link
Member

Try this plugin: https://github.com/rspack-contrib/rsbuild-plugin-node-polyfill

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