Incompatibility with later ES versions #1827
Replies: 1 comment 1 reply
-
Hey @TomDo1234 — I do think that we should audit our package dependencies for any that are incompatible with ESM, although this is more of a future feature rather than a current issue. I am also extremely jaded by the huge schism that ESM vs. CommonJS / etc. have caused in the Node ecosystem. Honestly I need to set some time aside to really dig in to find out if we can even support both seamlessly. Would you be interested in helping evaluate what's causing these Going to convert to a discussion, but let's keep conversation going there! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Report
I am using the default tsconfig
{ "compilerOptions": { "target": "es5", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "strict": false, "esModuleInterop": true, "skipLibCheck": true, "outDir": "./dist", "rootDir": "./src", "jsx": "react", }, "include": [ "src" ], "exclude": [ "node_modules", "dist", "build", ], "ts-node": { "transpileOnly": true } }
The issue with ES5 is that there is no top level await. I wanted top level await so I tried to increase to es2022, Had to then add moduleResolution: Node, then module: ES2022 in order to stop the import errors from appearing and get the top level await to not have an error on my IDE. Then I got an error in the console when trying to build, had to do add type: module to package.json.
After that I run yarn build, it does build but when you run it: import error on Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Steps to Reproduce
Other Details
Latest version of Payload as of the creation date of this post. 1.5.3
Beta Was this translation helpful? Give feedback.
All reactions