N
Nuxt2w ago
fenish

I cannot set module to preserve

Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.
Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.
8 Replies
kapa.ai
kapa.ai2w ago
Hi @fenish. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you are seeing:
Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.
Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.
means that "preserve" is not a valid value for the TypeScript --module compiler option. The allowed values are those listed in the error message. If you are trying to use "preserve" as a module option in your tsconfig.json, you should instead use one of the supported values, such as "esnext" or "nodenext", depending on your target environment and Nuxt version. For example:
{
"compilerOptions": {
"module": "esnext"
}
}
{
"compilerOptions": {
"module": "esnext"
}
}
There is no mention in the knowledge sources of a valid preserve value for the module option in Nuxt or TypeScript configuration. If you need to preserve module structure for bundling, that is typically a bundler (like Vite or Rollup) configuration, not a TypeScript compiler option. In fact, a recent Nuxt update specifically disables preserveModules in Vite due to related issues, so you should not expect to use a "preserve" module mode in your TypeScript config for Nuxt projects fix(vite): disable preserveModules. If you have further requirements about module preservation, please clarify your use case. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@253937964193677323> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
fenish
fenishOP2w ago
@kapa.ai
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: Sorry @fenish, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
fenish
fenishOP2w ago
i already have esnext @kapa.ai i already have esnext
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thank you for clarifying that you are already using "esnext" for the module option in your tsconfig.json. Based on the knowledge sources provided, "esnext" is a valid and recommended value for Nuxt projects, and there is no indication that "preserve" is or should be used as a value for the module option in Nuxt or TypeScript configurations. If you are encountering issues with module settings, ensure that your tsconfig.json does not use unsupported values and matches the expected configuration for your Nuxt version. If you are experiencing a specific problem with "esnext" as your module setting, please provide more details or error messages so I can assist you further. The knowledge sources do not mention any scenario where "preserve" would be valid or required for Nuxt projects. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@253937964193677323> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?