-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Description
Is your feature request related to a problem? Please describe.
My Nuxt server middleware relies on custom babel options. With Nuxt 2.15 and jiti my setup is broken.
I would like to be able to pass custom jiti options object (such as { transformOptions: ... }
) to fix that, however, currently Nuxt doesn't allow that. jiti is unilaterally called without any options whatsoever:
Describe the solution you'd like
I would like a new section in nuxt.config.js
, either top-level jiti
or build.jiti
, with jiti options. This is similar to build.babel
for that matter.
Example:
const config: NuxtConfig = {
build: {
jiti: {
transformOptions: {
babel: {
babelrc: true,
},
},
},
},
}
Describe alternatives you've considered
I'm going with this at the moment:
const config: NuxtConfig = {
createRequire: p => {
return jiti(typeof p === 'string' ? p : p.filename, {
transformOptions: { ... }
}
}
}
This is:
a) undocumented
b) needs boilerplate copy/paste and unneeded knowledge about p.filename
c) possibly unreliable and/or will need more boilerplate for production build
Ascor8522