[Bug?]: esm loader cannot find isBuiltin
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
In my project, I run this code;
$ yarn install
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ - asn1@npm:0.2.6, assert-plus@npm:1.0.0, aws-sign2@npm:0.7.0, aws4@npm:1.12.0, bcrypt-pbkdf@npm:1.0.2, buffer-crc32@npm:0.2.13, caseless@npm:0.12.0, concat-stream@npm:1.6.2, core-util-is@npm:1.0.2, dashdash@npm:1.14.1, ecc-jsbn@npm:0.1.2, and 47 more.
➤ YN0000: └ Completed in 0s 267ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1s 270ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 1s 951ms
and then
$ yarn run xxx
file:///C:/Users/xxx/Desktop/xxx/xxxxxx/.pnp.loader.mjs:6
import moduleExports, { isBuiltin } from 'module';
^^^^^^^^^
SyntaxError: The requested module 'module' does not provide an export named 'isBuiltin'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:127:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:193:5)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async initializeLoader (node:internal/process/esm_loader:74:19)
at async loadESM (node:internal/process/esm_loader:87:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
But I use yarn1.22.21 is ok. How I fix it?
To reproduce
{
"name": "xxxx",
"private": true,
"version": "1.3.16",
"scripts": {
"dev": "vite",
"electron": "electron --trace-warnings --development ./electron/"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-customizable"
}
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.6",
"@microsoft/signalr": "^6.0.7",
"@rollup/plugin-inject": "^5.0.3",
"@types/node": "^18.0.2",
"abort-controller": "^3.0.0",
"adm-zip": "^0.5.10",
"amqp-connection-manager": "^4.1.3",
"amqplib": "^0.10.0",
"animejs": "^3.2.1",
"axios": "^0.27.2",
"basic-ftp": "^5.0.2",
"bufferutil": "^4.0.6",
"color": "^4.2.3",
"core-js": "^3.8.3",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.3",
"element-plus": "^2.2.8",
"encoding": "^0.1.13",
"eventemitter3": "^4.0.7",
"eventsource": "^2.0.2",
"fetch-cookie": "^2.1.0",
"file-type": "16.5.4",
"filesize": "^10.1.0",
"fs-extra": "^10.1.0",
"hls.js": "^1.2.9",
"html2canvas": "^1.4.1",
"image-size": "^1.0.2",
"jimp": "^0.16.1",
"js-base64": "^3.7.2",
"jsbarcode": "^3.11.5",
"klaw": "^4.0.1",
"less": "^4.1.3",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"log4js": "^6.5.2",
"mime-types": "^2.1.35",
"mitt": "^3.0.0",
"mockjs": "^1.1.0",
"node-fetch": "2",
"nodejs-fs-utils": "^1.2.6",
"pdf-actions": "^1.2.2",
"qs": "^6.10.5",
"reconnecting-websocket": "^4.4.0",
"sass": "^1.53.0",
"shelljs": "^0.8.5",
"sql.js": "^1.8.0",
"stats.js": "^0.17.0",
"supports-color": "^9.2.2",
"swiper": "^8.4.5",
"tough-cookie": "^4.1.2",
"utf-8-validate": "^5.0.9",
"utils": "^0.3.1",
"v-drag": "^3.0.8",
"vant": "^3.5.2",
"vue": "^3.2.25",
"vue-awesome-swiper": "^5.0.1",
"vue-i18n": "9",
"vue-qr": "^4.0.9",
"vue-router": "^4.0.3",
"vue-screen-size": "^2.0.4",
"vuex": "^4.0.0",
"vuex-persist": "^3.1.3",
"vuex-persister": "^1.0.0",
"websocket": "^1.0.34",
"ws": "^8.9.0"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@vitejs/plugin-vue": "^3.0.3",
"commitizen": "^4.3.0",
"copy-webpack-plugin": "^11.0.0",
"electron-devtools-vendor": "^1.0.5",
"ts-loader": "^9.4.1",
"typescript": "^4.8.3",
"vite": "^3.0.9",
"vite-svg-loader": "^4.0.0",
"vue-tsc": "^0.40.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
}
}
Environment
System:
OS: Windows 10 10.0.19044
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Binaries:
Node: 20.9.0 - ~\AppData\Local\Temp\xfs-c7639823\node.CMD
Yarn: 4.0.2 - ~\AppData\Local\Temp\xfs-c7639823\yarn.CMD
npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.5.1 - ~\AppData\Local\pnpm\pnpm.EXE
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with Node 20.9.0 and Yarn 4.0.2, then inspect the generated .pnp.loader.mjs entry shown in the stack trace. Compare its ESM import with the Node version's supported module exports and verify the PnP loader starts without the isBuiltin export error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100