nuxt: Cannot include @nuxt/babel-preset-app in nuxt.config.js
Version
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 error
Additional comments?
Related: https://github.com/nuxt/nuxt.js/issues/4873#issuecomment-458741553
<div align="right">This bug report is available on Nuxt community (#c8574)</div>About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 16 (6 by maintainers)
This issue is due to
@nuxt/babel-preset-appis specified without any target.presets: ["@nuxt/babel-preset-app"]is the default preset with specified target in nuxt.But what happened in https://github.com/nuxt/nuxt.js/issues/4873#issuecomment-458722702 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:
The server and client babel config can be a new feature request, I think we can introduce
build.babel.clientandbuild.babel.serverwith same config asbuild.babel, like:How do you think @pimlie @LuXDAmore @mauxtin ? If you have any proposal, please comment here.
Doc PR: https://github.com/nuxt/docs/pull/1154
I think the “buildTarget” is missing.
It works.
@pimlie Good point! Will link the PR here as soon as it’s there. I’ll do some doc work today 😉
@pimlie Sorry, it’s my typo, should be
targets, I’ve updated the comment.Indeed, I’ll update the doc for function preset part
@mauxtin No, because you don’t set the
targets.Nuxt’s default preset is set up by default as the name suggests 😋