-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cannot include @nuxt/babel-preset-app in nuxt.config.js #4900
Comments
I've a project created with the What is expected? Reproduction link What is actually happening? Additional comments?
Same results. |
Maybe |
FWIW, I also mentioned the same problem here #4873 (comment) For now, I just removed this dependency completely (but ofc that's not a solution) |
This issue is due to
But what happened in #4873 (comment) mentioned by @mauxtin is a different issue that nuxt doesn't support different babel config in server and client. For now, I suggest using default babel preset provided by Nuxt, you can still add other configs(like: build.babel.plugins). Or you can use functional preset: build: {
babel: {
presets({ isServer }) {
const targets = isServer ? { node: 'current' } : { ie: 11 }
return [
[ require.resolve('@nuxt/babel-preset-app'), { targets } ]
]
}
}
} The server and client babel config can be a new feature request, I think we can introduce build: {
babel: {
client: {
presets: [...],
plugins: [...]
}
server: {
presets: [...]
}
}
} How do you think @pimlie @LuXDAmore @mauxtin ? If you have any proposal, please comment here. |
Can server even use any other target than node? Maybe we should force node as a target on server side? |
@abalabahaha User may specify different node verisons for server preset. |
@clarkdo If I understood correctly, simply adding this will include the default nuxt configuration, right?
However I am still getting the error |
@mauxtin No, because you don't set the Nuxt's default preset is set up by default as the name suggests 😋 |
@clarkdo I wasnt aware that presets could be a function as well, the docs doesnt reflect that feature (or that the target is required). Btw, should it be For me the functional approach would be enough as I am only interested in changing the target as @mauxtin was. Unfortunately that still doesnt work me, my exact code is as follows but when I open the page I get a babel: {
presets({ isServer }) {
console.log('HERE', isServer)
return [
[ require.resolve('@nuxt/babel-preset-app'), {
targets: isServer ? 'node' : {browsers}
}]
]
} (it indeed prints both |
@pimlie Sorry, it's my typo, should be Indeed, I'll update the doc for function preset part |
@clarkdo Yeah, that works. Thanks! |
@clarkdo Sounds good !
However I am still getting the error |
I think the "buildTarget" is missing.
It works. |
@manniL Although the issue is fixed, the docs have not yet been updated (that presets can be a fn). Maybe keep this open until the docs have been added (or at least a docs PR has been created)? |
@pimlie Good point! Will link the PR here as soon as it's there. I'll do some doc work today ;) |
Doc PR: nuxt/docs#1154 |
Version
v2.4.0
Reproduction link
https://codesandbox.io/s/q91mz897jq
Steps to reproduce
Include nuxt babel preset as described in docs: https://nuxtjs.org/api/configuration-build#babel
What is expected ?
Page loads correctly
What is actually happening?
Page doesnt load and shows a
regeneratorRuntime is not defined
errorAdditional comments?
Related: #4873 (comment)
The text was updated successfully, but these errors were encountered: