Hello,
I'm a typescript user and I would like to know if it would be possible to write the config file in typescript as it is possible for gulp with the use of ts-node. What I have in mind is to be able to import ts files in config to use some code in generate/routes for instance.
Thank you.
You can definitely do it in many different ways if you use nuxt programmatically, but you may also want to try typescript-require.
This will probably become a native feature at some point.
cmd
> yarn add ts-node typescript -D
package.json replace to this:json
{
...
"dev": "node -r ts-node/register node_modules/nuxt/bin/nuxt dev -c nuxt.config.ts",
"build": "node -r ts-node/register node_modules/nuxt/bin/nuxt build -c nuxt.config.ts",
"generate": "node -r ts-node/register node_modules/nuxt/bin/nuxt generate -c nuxt.config.ts",
...
}
cmd
> yarn dev
OR
> yarn build
OR
> yarn generate
References:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
cmd > yarn add ts-node typescript -Dpackage.jsonreplace to this:json { ... "dev": "node -r ts-node/register node_modules/nuxt/bin/nuxt dev -c nuxt.config.ts", "build": "node -r ts-node/register node_modules/nuxt/bin/nuxt build -c nuxt.config.ts", "generate": "node -r ts-node/register node_modules/nuxt/bin/nuxt generate -c nuxt.config.ts", ... }cmd > yarn dev OR > yarn build OR > yarn generateReferences: