@nuxt/babel-preset-app
2.18.1 · 28 Jun 2024MIT167.2k / weekRepositoryHomepagenpmAtom feed
2.18.1 is the newest release of 2.x.
In short
1 deprecated6 new4 fixed5 changed2 internal
- Deprecated
postcss: Deprecate config support
Release note
The section about @nuxt/babel-preset-app of a note shared by several packages.
Migration Guide
This version is addressing most of the problems of 2.5 and is without any breaking changes. For most of the users, a normal version upgrade would be enough. However, reading this guide can help to have a smooth upgrade.
General Tips
Using yarn as the package manager is more preferred as Nuxt is internally being tested against yarn
Before upgrade ensure to remove
yarn.lock,package-lock.jsonandnode_modulesAfter full install and testing, also consider upgrading other dependencies. The
yarn outdatedcommand can be used.
Missing App Dependencies
Because of how package managers (yarn, npm) work, a wrong version of a dependency from one of the other dependencies may be hoisted into node_modules. Nuxt is strict about this and provides instructions for dependency resolution so please follow it.
The well-known problem is with firebase package that requires to manually install node-fetch dependency in your project.
Reverting breaking changes
We accidentially introduced a change that broke the prod build for many people who are using Nuxt programatically. This has been resolved through #5413. Sorry for the inconveniences!
Core-js
Since core-js@2 and core-js@3 are both supported from babel 7.4.0, Starting from 2.6 Nuxt supports both versions (#5411). It is highly advised to stick with 2 (default) unless having a special dependency that needs 3. (Instructions for core-js@2 are not required but recommended)
core-js@3
Edit nuxt.config.js:
export default {
build: {
babel: {
presets({ isServer }) {
return [
[
require.resolve('@nuxt/babel-preset-app'),
// require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
{
buildTarget: isServer ? 'server' : 'client',
corejs: { version: 3 }
}
]
]
}
}
}
}Typescript
Nuxt 2.5 users may only require to add ts-node to the dependencies
Beta Testers : Replace
nuxtbynuxt-edge, and@nuxt/typescriptby@nuxt/typescript-edgein the following instructions.
Remove
nuxt-tsdependency (2.4 users only)yarn:
yarn remove nuxt-tsnpm:
npm remove nuxt-ts
Add
nuxtandts-nodetodependencies:yarn:
yarn add nuxt ts-nodenpm:
npm i nuxt ts-node
Add
@nuxt/typescripttodevDependencies:yarn:
yarn add -D @nuxt/typescriptnpm:
npm i -D @nuxt/typescript
Create an empty
tsconfig.jsonfile. Nuxt will automatically generate it with defaults at first run, then you can edit it to fit your needs
Features
babel-preset-app: Support specifying core-js version (#5411) (Xin Du (Clark))
typescript: Detect typescript based on
tsconfig.json
Fixes
Unexpected token export in importing babel runtime helper
core: Call ready to prevent breaking changes (Pooya Parsa)
build: Disable loading
babel.config.jsby default (#5365) (Xin Du (Clark))types: Add type definition for typescript.typeCheck
Chore
- Deprecated
postcss: Deprecate config support
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.