-
Notifications
You must be signed in to change notification settings - Fork 25
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
Cannot load "serverless.ts": Initialization error - caused by incompatible tsconfig module
setting that breaks serverless.ts compilation
#48
Comments
Thanks for raising this issue @justingrant.
I'd be happy to accept a documentation PR outlining this issue. Would you like to make it :) ?
At the moment, no additional language-specific (understand TS-specific) modification will be brought to main framework. However, discussion is open and PR are welcome to remove TS-specific code from main serverless/serverless to dedicated lib. Once this seperation has been made, such warning could be implemented. Please see serverless/serverless#9311 for additional info regarding this migration. |
@justingrant @fredericbarthelet I'm facing a similar issue with Serverless Typescript and ESModules. However, the workaround via
|
|
Or use npm to solve it: |
I have a similar issue. I work in monorepo and base I did some testing and setting It seems that Serverless cannot handle situation where |
I was in a similar situation with the monorepo. I got around this by having a So in the root directory have a
And then in the
|
I had a similar problem, in my case I solved it by setting the my {
"extends": "../../tsconfig.json",
"ts-node": {
"moduleTypes": {
"**/*.ts": "cjs"
}
}
} and I'm able to run |
I spent the last hour troubleshooting why serverless.ts was failing to load. The root cause was my tsconfig.json included
"module": "esnext"
which made the compiled severless.ts unable to berequire
-d by read.js. After a lot of googling and step-through debugging, I finally ended up at #28, which helped me identify a workaround: create a blank tsconfig file and use it for serverless.ts compilation using theTS_NODE_PROJECT
environment variable. Like this:To avoid others having the same painful experience, here's some suggestions:
TS_NODE_PROJECT
workaround be documented somewhere other than Support tsconfig-paths and specify tsconfig*.json #28 ?module
setting and any other tsconfig settings required for a successful compilation?AND/OR
For others who run across this error, here's a honeypot of Google keywords:
The text was updated successfully, but these errors were encountered: