With a freshly created Next.js app (using create-next-app) with TypeScript support, errors are occurring when running fastly compute serve as the transpilation step does not support certain features to be transpiled to es5. es5 is the default target for a new Next.js app with TypeScript support.
✘ [ERROR] Transforming const to the configured target environment ("es5") is not supported yet
bin/index.js:2:1265012:
2 │ ... n.default.Component{render(){const{statusCode:e,withDarkMode:t=...
╵ ~~~~~
The target environment was set to "es5" here:
../tsconfig.json:3:14:
3 │ "target": "es5",
╵ ~~~~~
Even with target set to es6, an error is occurring:
Error: Build failed with 1 error:
bin/index.js:2:1070811: ERROR: Transforming async generator functions to the configured target environment ("es6") is not supported yet
I was able to resolve this issue by configuring TypeScript to target esnext:
ES2018 was the oldest possible version that works for me, apart from ESNext, you might want to opt to it to be as compatible as possible with older environments
With a freshly created Next.js app (using
create-next-app
) with TypeScript support, errors are occurring when runningfastly compute serve
as the transpilation step does not support certain features to be transpiled to es5. es5 is the default target for a new Next.js app with TypeScript support.Even with
target
set toes6
, an error is occurring:I was able to resolve this issue by configuring TypeScript to target
esnext
:It would be helpful to add a small note to the instruction about TypeScript support.