You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How are you deploying your application? (if relevant)
next export
Describe the Bug
Changing the tsconfig.json -> compilerOptions -> target setting has no effect on static export builds and no error or warning occurs to indicate this.
Expected Behavior
Changing the TypeScript build target should be respected by the build engine like other TypeScript configuration settings, or an error or warning should indicate that the TypeScript target must always be a certain value.
Link to reproduction
To Reproduce
Create a new project: npx create-next-app@canary --typescript
Modify the build script in package.json to be next build && next export
Remove the Image import and Image tag from index.tsx because it will prevent static build from succeeding
Modify pages/_app.tsx with a trivial piece of functionality which uses an ES2022 feature
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { useEffect, useState } from 'react';
class Test {
#forMeOnly = true;
doSomething(): void {
console.log("FOR ME ONLY", this.#forMeOnly);
}
}
function MyApp({ Component, pageProps }: AppProps) {
const [test] = useState(new Test());
useEffect(() => test.doSomething());
return <Component {...pageProps} />
}
export default MyApp
Modify compilerOptions -> target in tsconfig.json to be ES2022
Execute npm run build
Note that in the chunk exported for _app-<cache-bust>.js in out/_next/static/chunks/pages that the private field #forMeOnly is enforced using WeakMap and not using the native JavaScript feature from ES2022
Expected to see #forMeOnly (or a minified version) and no WeakMap
The text was updated successfully, but these errors were encountered:
Verify canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Home
Binaries:
Node: 16.13.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant packages:
next: 12.1.7-canary.19
react: 18.1.0
react-dom: 18.1.0
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
next export
Describe the Bug
Changing the
tsconfig.json
->compilerOptions
-> target setting has no effect on static export builds and no error or warning occurs to indicate this.Expected Behavior
Changing the TypeScript build target should be respected by the build engine like other TypeScript configuration settings, or an error or warning should indicate that the TypeScript target must always be a certain value.
Link to reproduction
To Reproduce
Create a new project:
npx create-next-app@canary --typescript
Modify the build script in package.json to be next build && next export
Remove the Image import and Image tag from index.tsx because it will prevent static build from succeeding
Modify
pages/_app.tsx
with a trivial piece of functionality which uses an ES2022 featureModify compilerOptions -> target in tsconfig.json to be ES2022
Execute
npm run build
Note that in the chunk exported for
_app-<cache-bust>.js in out/_next/static/chunks/pages
that the private field #forMeOnly is enforced using WeakMap and not using the native JavaScript feature from ES2022Expected to see #forMeOnly (or a minified version) and no WeakMap
The text was updated successfully, but these errors were encountered: