question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

not able to overwrite compilerOptions

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kleisaukecommented, 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 https://github.com/vitejs/vite/issues/7015, which causes an infinite loop when it tries to transform/bundle lib/vips-es6.worker.js.

0reactions
danielroecommented, Oct 25, 2022

Closing this to track the feature request in https://github.com/nuxt/framework/issues/7471. The remaining issue here appears to be an upstream vite bug and is not the one described in the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

visual studio - Typescript error "Cannot write file ... because it ...
Cannot write file 'C:/{{my-project}}/node_modules/buffer-shims/index.js' because it would overwrite input file. It looks like this all the time.
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
Using tsconfig.json - TypeScript
Compiler options specified on the command line override those specified in the tsconfig.json file. @types , typeRoots and types. By default all visible...
Read more >
Cannot write file because it would overwrite input file TS
The error "Cannot write file because it would overwrite input file" occurs when we haven't specified the outDir directory in the exclude array...
Read more >
Module type overrides | ts-node - TypeStrong · GitHub
In these situations, our moduleTypes option can override certain files to be CommonJS or ESM. Similar overriding is possible by using .mts ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found