Skip to content

Upgrading nuxt 1 to 2

Breaking1.4.5 โ†’ 2.18.1Breaking17Security2Platform6Deprecated14New176Changed145Fixed469Other232

BreakingUpgrade verdict

16 breaking changes and 6 platform requirement changes and 2 security fixes.

  • A configuration option was renamed, so old configs using the old name need updating.
  • Renames the setup hook to `run:before`.
  • The legacy Nuxt variant is no longer supported.
  • If you install Nuxt with npm, you need to clean up your lockfile before or after upgrading, otherwise the install may break. Yarn users should be fine, though removing yarn.lock is still recommended.
Top 5 of 38 that need code or config changes

No longer states a Node.js requirement from 2.15.0 (was >=8.0.0).

Adds @nuxt/babel-preset-app 2.18.1, @nuxt/builder 2.18.1, @nuxt/cli 2.18.1, @nuxt/components ^2.2.1, @nuxt/config 2.18.1, @nuxt/core 2.18.1, @nuxt/generator 2.18.1, @nuxt/loading-screen ^2.0.4, @nuxt/opencollective ^0.4.0, @nuxt/server 2.18.1, @nuxt/telemetry ^1.5.0, @nuxt/utils 2.18.1, @nuxt/vue-app 2.18.1, @nuxt/vue-renderer 2.18.1, @nuxt/webpack 2.18.1.

Drops @nuxtjs/youch, ansi-html, autoprefixer, babel-core, babel-loader, babel-preset-vue-app, caniuse-lite, chalk, chokidar, clone, compression, connect, css-hot-loader, css-loader, debug, es6-promise, etag, extract-text-webpack-plugin, file-loader, fresh, friendly-errors-webpack-plugin, fs-extra, glob, hash-sum, html-minifier, html-webpack-plugin, launch-editor, launch-editor-middleware, lodash, lru-cache, memory-fs, minimist, opencollective, postcss, postcss-cssnext, postcss-import, postcss-import-resolver, postcss-loader, postcss-url, pretty-error, progress-bar-webpack-plugin, semver, serialize-javascript, serve-static, server-destroy, source-map, style-resources-loader, uglifyjs-webpack-plugin, upath, url-loader, vue, vue-loader, vue-meta, vue-router, vue-server-renderer, vue-template-compiler, vuex, webpack, webpack-bundle-analyzer, webpack-dev-middleware, webpack-hot-middleware, webpack-node-externals.

Installs 1296 packages in all (was 1198).

Breaking16
Renames externalsWhitelist to externalsAllowlist.
externalsWhitelistexternalsAllowlist
Renames the setup hook to run:before.
run:before
Drops support for nuxt-legacy.
nuxt-legacy
npm users must remove package-lock.json and reinstall before upgrading, or run npm update acorn --depth 20 && npm dedupe after upgrading to 2.4.0.
package-lock.jsonyarn.lockacorn
PostCSS options use a new format, which may require updating existing postcss configuration.
postcss
Dependency upgrades drop support for earlier Node versions; dotenv parses .env files differently in edge cases and glob requires / instead of \ on Windows.
dotenvglob
Vue 2.7 is now included as a dependency, so upgrading from Vue 2.6 may cause issues.
@nuxtjs/composition-api
Updates webpack postcss to v8.
postcsswebpack
Webpack loader matching by name or query now uses includes instead of exact match.
includes
Moves build.crossorigin to render.crossorigin.
build.crossoriginrender.crossorigin
Requires explicitly awaiting nuxt.ready() after new Nuxt(); not awaiting it now has a severe impact.
nuxt.ready()Nuxt
Moves TypeScript type checking configuration from build.useForkTsChecker to build.typescript.typeCheck.
build.useForkTsCheckerbuild.typescript.typeCheck
build.extend customizations must be compatible with Webpack 4.
build.extend
Uses Webpack 4, which may require plugin and config updates.
nuxt-edge
Server/client artifact isolation moves external build.publicPath content to .nuxt/dist/client.
build.publicPath.nuxt/dist/client.nuxt/dist
Due to the css-loader upgrade, CSS url() aliases must use ~assets instead of ~/assets.
css-loader~assets~/assets
Security2
Upgrades to nuxt@^2.15.7 are recommended for users of nuxt@2.15.5 or nuxt@2.15.6 due to a security advisory.
Prevents a potential XSS vulnerability when using vuex-router-sync.
vuex-router-sync
Platform6
Adds a minimum Node 14.18 version constraint.
Nuxt 2.16.0 only supports Node 14 and later, and going forward only officially supports Node versions that have not reached EOL.
Raises the minimum supported Node.js version to 12.0.0.
Updates all dependencies that require Node 10.x.
Raises the minimum required Node.js version to 8.9.0.
Drops support for Node < 8.6 for TypeScript users due to ts-loader v6.
ts-loader
Deprecated14
Deprecates the mode option.
mode
Deprecates the scrollBehavior option in favor of app/router.scrollBehavior.js.
scrollBehaviorapp/router.scrollBehavior.js
Deprecates the devModules option in favor of buildModules.
devModulesbuildModules
Renames transition to pageTransition and deprecates the old option.
transitionpageTransition
Deprecates PostCSS config support.
Deprecates isClient, isServer and isStatic in TypeScript types.
isClientisServerisStatic
Adds a warning for nuxt-ts deprecation.
nuxt-ts
Deprecates the ssr: false plugin option in favor of a mode option of 'all', 'client' or 'server'; ssr still works until Nuxt 3.
ssrmode
Deprecates styleResources due to performance issues; use the community style-resources module instead.
styleResources
Deprecates callback-based asyncData, fetch and middleware methods in favor of Promises or async/await.
asyncDatafetchmiddleware
Deprecates the vendor array, which is no longer used because of Webpack 4.
vendor
Removes DLL support because it was not stable enough and Webpack 4 is much faster.
Removes the obsolete AggressiveSplittingPlugin.
AggressiveSplittingPlugin
Deprecates the render.gzip option in favor of render.compressor.
render.gziprender.compressor