-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
ESM .postcssrc.ts
w. "type": "module"
results in ERR_REQUIRE_ESM
#15869
Comments
Start a new pull request in StackBlitz Codeflow. |
#15235 would fix this. But it's a breaking change, so it will probably be added in v6. Use |
.postcssrc.ts
+ "type": "module"
= ERR_REQUIRE_ESM
.postcssrc.ts
w. "type": "module"
results in ERR_REQUIRE_ESM
@brc-dd thanks! I tried using [Failed to load PostCSS config: Failed to load PostCSS config (searchPath: /Users/k/p/projec/packages/slide-decks): [TSError] ⨯ Unable to compile TypeScript:
error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'.
TSError: ⨯ Unable to compile TypeScript:
error TS5110: Option 'module' must be set to 'NodeNext' when option 'moduleResolution' is set to 'NodeNext'.
at createTSError (/Users/k/p/projec/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/Users/k/p/projec/node_modules/ts-node/src/index.ts:863:19)
at /Users/k/p/projec/node_modules/ts-node/src/index.ts:1379:34
at Object.compile (/Users/k/p/projec/node_modules/ts-node/src/index.ts:1440:28)
at Module.m._compile (/Users/k/p/projec/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions.<computed> [as .js] (/Users/k/p/projec/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)] {
diagnosticCodes: [ 5110 ]
}
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x8c
main.runService(0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4b4
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0x8d8
goroutine 18 [chan receive]:
main.runService.func1()
github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x40
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1a0
goroutine 19 [chan receive]:
main.(*serviceType).sendRequest(0x140001ac060, {0x100866300, 0x140000d3b00})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0x11c
main.runService.func3()
github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x38
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x308
error Command failed with exit code 1. My {
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "eslint-config-upleveled/tsconfig.base.json",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"checkJs": true,
"jsx": "preserve"
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"**/*.cts",
"**/*.cjs",
"**/*.mjs"
],
"exclude": ["node_modules"]
} I tried also switching to
|
Probably ts-node has some issue with nodenext. You can do something like: // tsconfig.json
{
// ...
"ts-node": {
"transpileOnly": true,
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node10"
}
}
} |
Just for added clarity: you can install v5 of IMO just stick with I wonder if Vite v6 could reconsider vendoring |
As an alternative to not vendoring |
Originally reported over here by @ElPrudi (before the issue was fixed in
postcss-load-config
):.postcssrc.ts
results into transpilation error #14758Describe the bug
Upgrading to a version after
postcss-load-config@5.0.0
(which added support for ESMpostcss.config.ts
w."type": "module"
does not resolve the problem in Vite thatrequire()
is used to load an ESMpostcss.config.ts
(or any other variations on the TS config) when in a"type": "module"
project:cc @bluwy
Reproduction
https://stackblitz.com/edit/vitejs-vite-2gepfr?file=package.json
Steps to reproduce
Create a config file called
postcss.config.ts
(or.postcssrc.ts
, as in the reproduction above):System Info
Used Package Manager
npm
Logs
See logs above
Validations
The text was updated successfully, but these errors were encountered: