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

Error when having type: module in package.json #82

Open
Jinjiang opened this issue Feb 14, 2024 · 1 comment
Open

Error when having type: module in package.json #82

Jinjiang opened this issue Feb 14, 2024 · 1 comment

Comments

@Jinjiang
Copy link

Reproduction: https://github.com/Jinjiang/reproductions/tree/vite-node-polyfill-20240214

pnpm install
pnpm build

error log:

error during build:
RollupError: "existsSync" is not exported by "node_modules/.pnpm/node-stdlib-browser@1.2.0/node_modules/node-stdlib-browser/esm/mock/empty.js", imported by "src/index.ts".
...

if works if you remove "type": "module" from package.json

@Jinjiang
Copy link
Author

Update: changing

import { existsSync, readFileSync } from 'fs'

into

import fs from 'fs'
const { existsSync, readFileSync } = fs

works. Only named exports don't.

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

1 participant