dev-resources.site
for different kinds of informations.
Fix NX Node executor ERR_REQUIRE_ESM Error
Published at
6/10/2022
Categories
nx
node
esm
cjs
Author
stomvi
Author
6 person written this
stomvi
open
昨晚睡前踩了個雷,來分享一下:
NX 新專案忘了裡面已經裝過 nanoid
,重裝了一次,然後 @nrwl/node:node
就開始報錯,找到引用 nanoid
的 model,在 sequelize hooks 裡,用報錯的解法改用 dynamic import 可以解決,查 NX issue 也看到幾個 node executor 不支援 static import ESM 的問題。
然後剛剛去看 nanoid
,3 天前 nanoid@4
migrate 到純 ESM 不支援 CJS 了⋯⋯降級回 nanoid@3
就解決了,等 NX issue #10414 merge 看有沒有改善吧。
Reference
esm Article's
30 articles in total
Bundling without a bundler with esm.sh
read article
Building NPM packages for CommonJS with ESM dependencies
read article
Web Development Without (Build) Tooling
read article
Dual Node TypeScript Packages - The Easy Way
read article
Oh CommonJS! Why are you mESMing with me?! Reasons to ditch CommonJS
read article
The Ongoing War Between CJS & ESM: A Tale of Two Module Systems
read article
How I optimized Carousel for EditorJS 2x in size.
read article
Transitioning from CommonJS to ESM
read article
Node.js, TypeScript and ESM: it doesn't have to be painful
read article
Set up Hot Reload for Typescript ESM projects
read article
Set up a Node.js project + TypeScript + Jest using ES Modules
read article
ESM & CJS: The subtle shift in bundlejs' behaviour
read article
Mastering the Art of ESM and CJS Package Handling
read article
Modules & Modules & Modules, Oh My!
read article
How to build TypeScript to ESM and CommonJS
read article
ES Modules & Import Maps: Back to the Future
read article
How to use ESM on the web and in Node.js
read article
Custom ESM loaders: Who, what, when, where, why, how
read article
Fix NX Node executor ERR_REQUIRE_ESM Error
currently reading
Creating a Node.js module for both CommonJS & ESM consumption
read article
STOP using require() in node backend
read article
JavaScript Module Ecosystem
read article
Declarative database modelling
read article
Expressjs: Javascript written in ECMAScript 2015 (ES6)
read article
How to use ES Modules with Node.js
read article
What does it take to support Node.js ESM?
read article
Build modular app with Alpine.js
read article
TS and ts-jest meet “type”: “module”
read article
ESM doesn't need to break the ecosystem
read article
constructor() dynamic import()
read article
Featured ones: