serverless-plugin-typescript
serverless-plugin-typescript copied to clipboard
"noEmit": true in tsconfig.json causes failure to compile
Adding
{
...
"noEmit": true,
...
}
to tsconfig.json
causes this error.
Removing this line results in a successful compile.
> [email protected] lambda /Users/user/code/foobar
> serverless offline
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: Invoke offline
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Error --------------------------------------------------
Typescript compilation failed
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: Typescript compilation failed
at Object.<anonymous> (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/src/typescript.ts:78:11)
at Generator.next (<anonymous>)
at /Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/typescript.js:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/typescript.js:3:12)
at Object.run (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/typescript.js:62:12)
at TypeScriptPlugin.<anonymous> (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/src/index.ts:132:42)
at Generator.next (<anonymous>)
at /Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
at TypeScriptPlugin.compileTs (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/index.js:103:16)
at TypeScriptPlugin.<anonymous> (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/src/index.ts:35:20)
at Generator.next (<anonymous>)
at /Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
at Object.before:offline:start [as hook] (/Users/user/code/foobar/node_modules/serverless-plugin-typescript/src/index.ts:34:42)
at BbPromise.reduce (/Users/user/code/foobar/node_modules/serverless/lib/classes/PluginManager.js:464:55)
From previous event:
at PluginManager.invoke (/Users/user/code/foobar/node_modules/serverless/lib/classes/PluginManager.js:464:22)
at PluginManager.run (/Users/user/code/foobar/node_modules/serverless/lib/classes/PluginManager.js:496:17)
at variables.populateService.then (/Users/user/code/foobar/node_modules/serverless/lib/Serverless.js:116:33)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:120:23)
From previous event:
at Serverless.run (/Users/user/code/foobar/node_modules/serverless/lib/Serverless.js:103:74)
at serverless.init.then (/Users/user/code/foobar/node_modules/serverless/bin/serverless.js:44:32)
at /Users/user/code/foobar/node_modules/graceful-fs/graceful-fs.js:111:16
at /Users/user/code/foobar/node_modules/graceful-fs/graceful-fs.js:45:10
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
From previous event:
at initializeErrorReporter.then (/Users/user/code/foobar/node_modules/serverless/bin/serverless.js:44:10)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
at process.topLevelDomainCallback (domain.js:120:23)
From previous event:
at /Users/user/code/foobar/node_modules/serverless/bin/serverless.js:30:6
at Object.<anonymous> (/Users/user/code/foobar/node_modules/serverless/bin/serverless.js:71:7)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
OS: darwin
Node Version: 10.15.3
Serverless Version: 1.47.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lambda: `serverless offline`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lambda script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2019-07-10T23_31_58_334Z-debug.log
Same issue here. Using Next.js which forced this setting upon us. This message could detail the reasons of failure I think.
Same issue here, and similar to mareksuscak situation i am being forced by ESLint on VSCode to set this setting as for some reason the typescript-eslint/parser
does not work without the noEmit: true
for me