@nuxt/babel-preset-app
2.18.1 · 28 Jun 2024MIT167.2k / weekRepositoryHomepagenpmAtom feed
67 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
2.7.0
14 May 2019- Deprecated
vue-app: rename
transitiontopageTransitionand deprecate it Configurable aliases
Add babel config types
DX Improvements
SSR logs in your browser
We all know the
console.logdebugging method, but when working with universal applications, you have to remember that sometimes, your logs are in your terminal and not in your browser console.This can be really annoying when developing a Nuxt.js application, starting with this version and running
nuxt dev, the ssr logs are now reported to your browser console:nuxt-logs-ssr
Detecting
store/creationNuxt.js now detects when you created a
store/directory and will reload himself auto-magically so you don't have to restart it anymore.nuxt-store-watch
PS: We also improved the
serverMiddlewarewatch to restart Nuxt.js and clean their cacheFeatures
- Deprecated
vue-app: rename
transitiontopageTransitionand deprecate it Configurable aliases
Typescript
Only for typescript users, Nuxt.js v2.7 dropped support for node < 8.6 relate to
ts-loader v6Add babel config types
Fix
context.apptypeFix
extendRoutesmethod typePrevent
ts-nodeto register twice
2.6.2
15 Apr 2019- Security
Prevent potential XSS vulnerabiliy when using
vuex-router-sync(nuxt/devalue#8) (vuejs/vuex-router-sync#89) Custom
router.basesupport for banner url and loading screen (#5470) (nuxt/loading-screen#8)
2.6.1
4 Apr 20192.6.0
4 Apr 2019- Deprecated
postcss: Deprecate config support
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_modules
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
firebasepackage that requires to manually installnode-fetchdependency 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@2andcore-js@3are 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 forcore-js@2are not required but recommended)core-js@3Edit
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-nodeto thedependenciesBeta 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
2.5.1
21 Mar 2019- Removed
fix: remove consola.debug for hooks
chore: unsupport nuxt-legacy (pooya parsa)
2.5.0
21 Mar 2019- Deprecated
ts: Deprecate
isClient,isServer,isStatic - Deprecated
ts: Add warning for nuxt-ts deprecation
Please replace
nuxt-tsdependency and usenuxt+@nuxt/typescript. (Alsonuxt-ts-edgetonuxt-edge+@nuxt/typescript-edgefor edge users)
15,000 line changes with 230 squashed commits by more than 30 contributors made this version possible! :heart:
What's new?
Typescript DX
No longer needed to install
nuxt-tsfor typescript support. Nuxt.js officially supports TS by installing@nuxt/typescript. Please see #5079 for reasons behind such migration.Babel
Babel 7.4, Core-js v3, and
Object.assignpolyfill for better browser support.Stability
More than 30 fixes, refactors and performance improvements.
Open in Browser
Use
nuxt dev -oto instantly open project in the browser and enjoy a cool loading screen:nuxt-loading-screen
.nuxtignore
Before v2.5, you were able to ignore files through an ignore prefix. As using the prefix over and over, ignoring files (and implementing custom structures) was a bit tedious on the long run. We came up with something more sophisticated: A
.nuxtignorefile. Following the same specs as a.eslintignoreor a.gitignorefile, you can now define what files or folders to ignore through a.nuxtignorefile in your project root.Examples and more info in the .nuxtignore docs
[IMPORTANT] Migration Guide
Lock Files
For a clean upgrade, please remove
yarn.lock/package-lock.jsonfile from your project before upgrade.Programmatic API / Middleware
If not already done, please explicitly call
nuxt.ready()afternew Nuxt().nuxt.ready()was alwaysasync, but not awaiting the function call has now a severe impact.const nuxt = new Nuxt(config) ++ await nuxt.ready()
TypeScript
Please replace
nuxt-tsdependency and usenuxt+@nuxt/typescript. (Alsonuxt-ts-edgetonuxt-edge+@nuxt/typescript-edgefor edge users)
{ -- "nuxt-ts": "^2.4.2" ++ "@nuxt/typescript": "^2.5.0" ++ "nuxt": "^2.5.0" }Configuration API to customize/disable type checking has been moved from
build.useForkTsCheckertobuild.typescript.typeCheck. Please see #5079 for more details.
build: { -- useForkTsChecker: false // or ForkTsChecker options ++ typescript : { ++ typeCheck: false // or ForkTsChecker options ++ } }Features
babel: Include
es6.object.assignby default (Clark Du)cli: Lock project during build or generate
cli: Option to open the project in the browser
generate: Return non-zero code or page error (fixes #4991)
module: Support src as a function in addModule
Support
.nuxtignore(#4647) (Xin Du (Clark))Support
devModulesoptionts: Nuxt configuration typedefs
vue-app: Universal fetch
vue-renderer: Improvements
vue-renderer: Use async fs
ts: Better DX for typescript support
Loading screen (#5251) (Sébastien Chopin, Pooya Parsa)
Support core-js 3 (#5291) (Xin Du (Clark))
Fixes
builder, vue-app: Order of plugin execution based on order in array
Correct public path in generation and start (#5202) (Xin Du (Clark))
Default for-exit to false to prevent dev exit (pooya parsa)
Disable "analyze" for nuxt generate
Disable parallel build when extractCSS is enabled (Clark Du)
Extra properties in templateFiles (#4925) (Xin Du (Clark))
Fix non standard esm modifications (pooya parsa)
Generate failure
keep-alive component data should not be updated (#5188) (Xin Du (Clark))
Not send Server-Timing header if no timing info (Clark Du)
postcss: Default to preset-env and cssnano last
publicPath is not reactive in dev restarting (#5227) (Xin Du (Clark))
Refactor file watchers (chokidar/linux workaround)
Remove cache-loader for external resources (#4915) (Xin Du (Clark))
Respect namespaced in store module (#5189) (Xin Du (Clark))
Revert templatFiles name (#4924) (Xin Du (Clark))
Trailing comma in tsconfig
- Deprecated
ts: Deprecate
isClient,isServer,isStatic types: Reflect chainlable NuxtLoading methods
Unexpected token .... Expected a property name in Safari (Clark Du)
vua-app: Clone mount error to prevent mutating read-only error object
vue-app: Avoid css chunk error
webpack: Clone
config.entry(fixes #4849)Disable extract-css-chunks-webpack-plugin in dev mode (#4888) (Xin Du (Clark))
server: Handle decodeURI error
Correct socket address in use error message (Clark Du)
utils: Relax lock settings
vue-app: Multiple named views cause invalid syntax
webpack: Loaders in extend config is broken (#5292) (Xin Du (Clark))
vue-app: Duplicated router.base when using context.redirect(object)
vue-app: Decode router base to support unicode characters
Performance Improvements
Await routeData promises in parallel
core: Skip esm for node_modules and non .js files
webpack: Use
futureEmitAssetsts: transpileOnly when using
nuxt-ts start
Refactors
- Deprecated
ts: Add warning for nuxt-ts deprecation
2.4.5
26 Feb 2019dependencies: update serve-placeholder and esm
2.4.4
26 Feb 20192.4.3
6 Feb 2019utils: Fix
serializeFunctionfor external importsconfig: Warn when using array for postcss config
module: support src as a function in addModule
Bugfixes
utils: Fix
serializeFunctionfor external importsconfig: Warn when using array for postcss config
module: support src as a function in addModule
server: await buildDone hook
2.4.1
30 Jan 20192.4.0
28 Jan 2019- Breaking
⚠️ Experimental: Enable
HardSourceWebpackPluginbyhardSource: trueinhardSourceofnuxt.config.js Full static generated mode to generate offline-ready static websites with Nuxt by default
Fabula, a Vue/Nuxt-inspired tool for running tasks on local and remote hosts
Upgrade Note
Due to a known problem (webpack/webpack#8656, #4869, #4839) users of npm should either remove
package-lock.jsonand reinstall before upgrade or usenpm update acorn --depth 20 && npm dedupeafter upgrading to 2.4.0. yarn users should have no problems but removingyarn.lockstill recommended before the upgrade process.Important news
New core team member
We are really proud to announce Kevin Marrec (@kevinmarrec) as a new core team member of Nuxt.js. He is French 🇫🇷 and responsible for the TypeScript integration 💚
Official Consulting
We now offer official support & consulting from the core team. We partnered with Otechie for the process and already did some beta-tests with selected companies.
Are you interested or curious?
Learn more on otechie.com/nuxt :raised_hands:RFC Process
We invite you to take a look at our nuxt/rfcs repository where we discuss the future of Nuxt and its vision.
Here are some interesting proposals if you want to learn more about the upcoming changes of Nuxt:
Full static generated mode to generate offline-ready static websites with Nuxt by default
Fabula, a Vue/Nuxt-inspired tool for running tasks on local and remote hosts
Improve @nuxt/config package to support a
config/directory and autocompleteNuxt Workers to open more possibilities on the server part (clustering, PM2 integration, HMR on the server and more)
Module improvements to give more power to Nuxt modules
And many more 💚
Release Plan
Starting with this release, Nuxt will adhere to a formalized release plan (as good as possible). Also, an end of life for older major versions is defined within RELEASE_PLAN.md.
Quick summary:
Nuxt major releases are planned every 6 months.
The release cycle for Nuxt.js minor versions is roughly 4 weeks.
Fixes will be released as soon as possible after the actual PR/commit
We strongly invite you to read the RELEASE_PLAN.md for further details.
Speaking of TypeScript...
TypeScript support has landed!
nuxt-ts
In order to run Nuxt with TypeScript, we created a new distribution, called nuxt-ts (we also have nuxt-ts-edge).
We want to thank @hmsk for his donation of the package name on npm ❤️You can explore Nuxt TypeScript example or play with it directly in our Nuxt TS CodeSandBox.
For a more advanced example, you can look at the HackerNews-TS repo or play with it on CodeSandBox, made by @husayt & @kevinmarrec.
This work has been made by @kevinmarrec with the help of @pi0 & @Atinux.
:warning: Experimental: We are waiting for your feedback to keep improving it and breaking changes can occur without a semver major release. However, all changes will be documented properly
Smart prefetching
Nuxt.js will automagically prefetch the code-splitted pages linked with
<nuxt-link>when visible in the viewport by default. This hugely improves the end user performances, inspired by quicklink.nuxt-prefetch-comparison
Demos are online and we recommend you to try it out to feel the difference:
No prefetching (v2.3): nuxt-no-prefetch.surge.sh
With prefetching (v2.4): nuxt-prefetch.surge.sh
Bonus: we added
$nuxt.isOnlineand$nuxt.isOfflinewhich is reactive, so you can use it directly inside your components (see this example).You can learn more about this feature in the associated PR #4574 and in the documentation.
HMR & best practices for
store/Save more development time with full HMR support for the store (
mutations,getters, andactions).nuxt-vuex-hmr
This feature has been implemented by @manniL & @Atinux on PRs #4589, #4582 and #4791
Autocomplete for VS Code (via. Vetur extension)
If you are using VS Code, with this version, you will now have autocomplete for Nuxt.js components:
nuxt-vs-autocomplete
This feature has been implemented by @octref & @Atinux on PR #4524
Port taken? Nuxt got your back!
If Nuxt wants to listen on a port which is already used, it will warn you in development and listen to a free port instead:
49249621-efe2e780-f431-11e8-90fb-ba48e67ba5c9
In production it will throw an error instead to avoid unwanted behavior:
49249634-f8d3b900-f431-11e8-9f51-afbf3ffc68ed
This feature has been implemented
Suggest installing missing dependencies or mismatches
Nuxt requires all peer like dependencies as a dependency for easier usage. Sometimes this causes unwanted behaviors when users explicitly add a specific version in their package.json which is incompatible with nuxt. This could also help to resolve popular Vue packages version mismatch error (#198, #669, #1084, #1414, #1851, #2079, #2406, #3454).
Nuxt is now able to automatically self-verify installed dependencies and warn with a proper message in case of detecting problems.
image
This feature has been implemented
Auto-detection of modern bundles
When running
nuxt start, Nuxt will automatically detect if you built your app modern mode enabled. No need to runnuxt start --modernexplicitly anymore 🌟screenshot 2018-11-30 at 16 55 48
This detection was created
Plugin modes and file extensions
Until now, you used
ssr: falsein your plugin declarations to disable server-side rendering. We decided to deprecate that option and introduce amodeinstead, which can be'all','client'or'server'. No worries,ssris still working (until Nuxt 3).The new feature coming with the
modeis that you can define it by using the file suffix:plugins/plugin.server.jsplugins/plugin.client.jsplugins/plugin.js
By adding the plugins to your
nuxt.config.js:plugins: [ '~/plugins/plugin.server.js', '~/plugins/plugin.client.js', '~/plugins/plugin.js' ]
The declaration will be internally transformed to:
plugins: [ { mode: 'server', src: '~/plugins/plugin.server.js' }, { mode: 'client', src: '~/plugins/plugin.client.js' }, { mode: 'all', src: '~/plugins/plugin.js' } ](If you specify the
modemanually, it will overwrite the suffix detection)This feature has been implemented
Module commands
Nuxt modules can now include
binscripts that are recognized by Nuxt's CLI.Here's an example of
my-module/bin/command.js:#!/usr/bin/env node const consola = require('consola') const { NuxtCommand } = require('@nuxt/cli') NuxtCommand.run({ name: 'command', description: 'My Module Command', usage: 'command <foobar>', options: { foobar: { alias: 'fb', type: 'string', description: 'Simple test string' } }, run(cmd) { consola.info(cmd.argv) } })The command could be run with:
npx nuxt command arg1 arg2
You can learn more about that in the modules command documentation.
:warning: Experimental: We are waiting for your feedback to keep improving it and breaking changes can occur without a semver major release. However, all changes will be documented properly <3
This feature has been implemented
PostCSS in Vue Components
You can now use
lang="postcss"in your Vue components. Postcss has applied to all your styles anyway (e.g. to resolve aliases like~) but thelangattribute enables autocomplete and syntax highlighting for some IDEs.nuxt-postcss
This feature has been implemented
No more extensions for Stylesheets needed
stylesheet extensions
We are concerned to improve the Developer Experience ("DX") with each release. This small change allows you to omit the file extension for CSS/SCSS/Postcss/Less/Stylus/... files listed in the
cssarray inside yournuxt.config.js. For thepluginsorserverMiddlewarekey, this is already possible.This feature has been implemented
SSR Bundle improvements
We made a full rewrite of how SSR bundle is packaged.
This means better performance, less memory overhead, fewer OOM crashes and easier SSR bundle debugging.
_ Before After Diff Dist 8.2M 7.2M -1M / 12% Dev 281 MB (RSS: 439 MB) 237 MB (RSS: 354 MB) -44M / 16% (RSS: -85M / 19%) Start 106 MB (RSS: 169 MB) 71.7 MB (RSS: 137 MB) -34M / 32% (RSS: -32M / 19%) This feature has been implemented
Other changes
process.moderncan be used for distinguishing modern environment.Add
server.timingto give Server-Timing header, useful for monitoring and performances overview (PR #4800)- Breaking
⚠️ Experimental: Enable
HardSourceWebpackPluginbyhardSource: trueinhardSourceofnuxt.config.js You can now set
scrollToToptofalsein pages (PR #4564)Aliases for
nuxt-linkandnuxt-child(n-linkandn-child) are available now (PR #4525)Components can now be used in
PascalCaseas recommended by the Vue styleguide (PR #4396)VueMetas
headAttrsare now supported for the appTemplate (PR #4536)More browsers are added to the list of modern browsers (PR #4516, PR #4775)
Loaded resources can now have a
crossoriginattribute (PR #4472)Modern mode resources are preloaded and will be pushed via HTTP2 server push if set (PR #4508)
Add option to disable the
compressionmiddleware (PR #4381)Add option to disable the
FriendlyErrorsWebpackPluginoverlay (PR #4381)Add
excludeoption to exclude pages from beinggenerated(in static mode) but still get rendered via fallback/SPA (PR #4754)Support
build.hotMiddleware.client(PR #4796)New examples have been added:
styled-vue (PR #4712)
Internal changes:
feat: use
runInNewContext: truefor nuxt devfeat: check modern build file in modern mode
refactor: migrate to extract-css-chunks-webpack-plugin
Further Patches (30+)
hotfix(vue-app): ReferenceError error passed with routeChanged (PR #4444)
vue-app: Handle
middlewarecorrectly when usingVue.extendin layout (fix #4724)Fix (vue-renderer): remove
undefinedscript in modern mode & generated (0a21d4b)Add option to rewatch on path after raw fs event (PR #4717)
builder, module: addLayout and nuxt.config precedence over auto-scanned layouts (PR #4702)
Support plugins with a directory and index.js (PR #4714)
Use case insensitive regex for webpack loader rules (PR #4728)
Require postcss module via resolver (PR #4737)
Safari fix is not injected in client modern mode (ecf76d9)
server: Allow rendering urls with unicode characters
builder: Add lodash inside templates (PR #4368)
Fall back to default value when
publicPathis falsy (PR #4365)modern=true or false not work as expected (PR #4378)
Empty error message in dev mode (3d990fe)
progress-bar: Allow 0 for values and remove duplicate defaults (PR #4397)
vue-app: Allow passing custom props to error function (PR #4462)
webpack: deepClone before calling extendConfig (PR #4464)
vue-app: Router.meta is null on extendRoutes(PR #4478)
Merge route.meta into options.meta (PR #4479)
Improvements for build and dev stability (PR #4470)
vue-app: Fix route meta to handle order (45be638)
dev: Show correct path when webpack watched files changed (25dea5f)
webpack: Allow changing devtool with extend (PR #4515)
keepAliveProps broken in <nuxt-child> (PR #4521)
Csp SHA hashes accumulate when using custom script-src rules
Duplicate style in extractCSS
Hmr in modern mode
Wrong devMiddleware in non-modern dev mode (3515115)
ts: Fix
$nuxt.$loadingtypedefsts: Add missing
loadingproperty to Component optionsMatch subdir under node_module in transpile
2.3.4
26 Nov 2018(Please skip
v2.3.3release. It was mistaken.)(Please skip
v2.3.3release. It was mistaken.)2.3.2
20 Nov 2018Use exact versions for Nuxt internal packages
Fallback to default value when
publicPathis falsyAdd lodash inside templating
2.3.1
16 Nov 2018- Deprecated
Deprecate
styleResourcesbecause of performance issues. Use our new community module instead (it's a drop-in replacement) - Deprecated
Deprecate callback-based
asyncData,fetchandmiddlewaremethods. Use Promises or async/wait instead. CLI and DX improvements
Release Notes
With v2.3, Nuxt.js is splitted into smaller packages (Aka a mono-repo). This means smaller packages, independent versioning support and ability to replace any part of Nuxt.js without dirty hacks. Before this release, we carefully tested the latest updates using edge release channel against real-world projects and there should be no breaking changes.
Please note that for upgrading Nuxt.js just changing version inside
package.jsonis not enough. Please useyarn upgradeornpm upgradeso that the final directory structure ofnode_moduleswill be correct. In case of problems clean upnode_modulesandyarn.lock/package-lock.json. Still having problems? open an issue in cmty!Fixes and Enhancements
CLI and DX improvements
CLI cleanups and improvements
Improve nuxt-loading component
Set defaults for port and host values
Dynamically read environment variables when loading
nuxt.config.js(PR #4208)Support custom pushAssets function to control http2 push headers
Reduce duplicate code in
routes.jsPrint warning when using
build.extractCSS.allChunksThrow an error when layout property is not string
Use
require.resolveto get the path of babel-loaderCheck style resources for existence
Serialize config head fn shorthand correctly
Don't accept ranges
Correctly resolve layouts with nested custom dir
Warn on unknown mode
Use
postcss.orderto change order of postcss pluginsFix for double escaping static class on SSR
Fix stable route sorting for Node v11
New Features
Dedicated help command (
nuxt help [cmd])List commands
nuxt --helpSupport asynchronous
nuxt.config.js
Dependency Upgrades
Deprecations
- Deprecated
Deprecate
styleResourcesbecause of performance issues. Use our new community module instead (it's a drop-in replacement) - Deprecated
Deprecate callback-based
asyncData,fetchandmiddlewaremethods. Use Promises or async/wait instead.
Internal Refactors
Migrate nuxt into a mono-repo
Refactor core into
@nuxt/core,@nuxt/serverand@nuxt/vue-rendererRefactor builder into
@nuxt/builderand@nuxt/webpackMove
@nuxtjs/babel-preset-appinto nuxt mono-repo and republish it as@nuxt/babel-preset-appMove common config to
@nuxt/configPackaging and development improvements
Extract
eslint-configinto own packageSeveral test utils cleanups (PR #4180)
2.3.0
16 Nov 2018
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.