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

can't use child_process or fs module? #18

Closed
egradman opened this issue Nov 1, 2021 · 2 comments
Closed

can't use child_process or fs module? #18

egradman opened this issue Nov 1, 2021 · 2 comments

Comments

@egradman
Copy link

egradman commented Nov 1, 2021

I'm building a new plugin that needs to access the filesystem and spawn child processes. But npm run dev throws an error when I import and use either of these modules.

How to replicate:

  1. clone this repo
  2. add import { spawn } from 'child_process'; to main.ts (note, that this alone does not cause the issue)
  3. add spawn("something") to onload()
  4. npm run dev

The error I get is main.ts:2:29: error: Could not resolve "child_process" (use "platform: 'node'" when building for node)

Is this related to #11 and the switch to ESBuild instead of Rollup? <-- I don't understand any of this, but I do notice that all the other plugins that use child_process and fs refer to rollup in package.json instead of esbuild.

@lishid
Copy link
Collaborator

lishid commented Nov 1, 2021

I will try to figure this out!

@lishid
Copy link
Collaborator

lishid commented Nov 1, 2021

I have updated the build script to fix this issue.

@lishid lishid closed this as completed Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants