Skip to content
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

not able to overwrite compilerOptions #14601

Closed
boostie opened this issue Aug 15, 2022 · 8 comments
Closed

not able to overwrite compilerOptions #14601

boostie opened this issue Aug 15, 2022 · 8 comments

Comments

@boostie
Copy link

boostie commented Aug 15, 2022

Environment

mac os

Reproduction

adding the following values into tsconfig.json

"compilerOptions": {
    "lib": [
      "es2020", "esnext"
    ],
    "module": "commonjs",
    "target": "es2020"
  }

Does not override the .nuxt/tsconfig.json file and keeps target as ESNext

Describe the bug

I need to overwrite the compilerOptions because during the "nuxi run dev" I am unable to load a package that requires a different target. When using the following code for the main tsconfig.json file at the root of the project, it does not overwrite the changes and resulting target is always as its set initially by nuxi.

{
  // https://v3.nuxtjs.org/concepts/typescript
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "lib": [
      "es2020", "esnext"
    ],
    "module": "commonjs",
    "target": "es2020"
  }
}

There needs to be a way to overwrite this. If I build the project, the imported module does not give errors. During the development, I am getting compilation errors for

Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari13" + 2 overrides)

which should be corrected by changing the target during the compilation.

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

You can set this in your Nuxt config, within typescript.tsConfig.

@boostie
Copy link
Author

boostie commented Aug 15, 2022

Thanks, I was actually able to change it using that setting, the error still remains thought. Does someone know the difference between building and running as dev for the error below? (when built, no error is popping up)

Big integer literals are not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari13" + 2 overrides)

    node_modules/@solana/web3.js/lib/index.browser.esm.js:4466:20:
      4466 │     const U64_MAX = 2n ** 64n - 1n;

Thanks

@danielroe
Copy link
Member

Likely your issue is not about your tsconfig, but maybe esbuild or rollup target. Would you provide a reproduction? 🙏

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2022
@Redemption198
Copy link

I also encountered this issue while testing wasm-vips with Nuxt 3, the issue seems to be caused by Vite/esbuild as mentioned here vitejs/vite#9062.

A Nuxt 3 reproduction is available here.

@kleisauke
Copy link

kleisauke commented Oct 12, 2022

@Redemption198 To fix the dev server you can exclude wasm-vips from pre-bundling and set the required COOP and COEP headers, for example:

// nuxt.config.ts
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
    serverMiddleware: ['~/middleware/coop-coep-headers.ts'],
    vite: {
        optimizeDeps: {
            exclude: ['wasm-vips']
        }
    }
})
// middleware/coop-coep-headers.ts
export default function (req: any, res: any, next: any) {
    res?.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
    res?.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
    next()
}

The production build is (unfortunately) currently broken, as you noticed. This is due to issue vitejs/vite#7015, which causes an infinite loop when it tries to transform/bundle lib/vips-es6.worker.js.

@Redemption198
Copy link

@Redemption198 To fix the dev server you can exclude wasm-vips from pre-bundling and set the required COOP and COEP headers, for example:

// nuxt.config.ts

// https://v3.nuxtjs.org/api/configuration/nuxt.config

export default defineNuxtConfig({

    serverMiddleware: ['~/middleware/coop-coep-headers.ts'],

    vite: {

        optimizeDeps: {

            exclude: ['wasm-vips']

        }

    }

})
// middleware/coop-coep-headers.ts

export default function (req: any, res: any, next: any) {

    res?.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')

    res?.setHeader('Cross-Origin-Opener-Policy', 'same-origin')

    next()

}

The production build is (unfortunately) currently broken, as you noticed. This is due to issue vitejs/vite#7015, which causes an infinite loop when it tries to transform/bundle lib/vips-es6.worker.js.

Thanks, I'll try that again in the future 👍

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Oct 25, 2022
@danielroe
Copy link
Member

Closing this to track the feature request in #14893. The remaining issue here appears to be an upstream vite bug and is not the one described in the issue.

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
@fruitpool69
Copy link

having a similar issue with Nuxt 3 using nitro preset: 'vercel-edge' the target defaults to es2019 which causes build errors leaving you unable to deploy to Vercel if any package you are using depends on es2020 such as:

ERROR: Big integer literals are not available in the configured target environment ("es2019")

I've tried many different methods to try and override this and cannot, so essentially its bricked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants