Repository navigation
v2.0.0
Migration guide for 2.0.0
Your migration is mostly straightforward as Nuxt 2 does not makes breaking changes. So you can try your chance and simply upgrade to Nuxt 2 using yarn add nuxt@^2.0.0 or npm install nuxt@^2.0.0 😉
The long but peaceful approach
- Carefully read release notes
- If you are using a VCS for your project commit and push latest changes and then checkout into a new branch
- Stop any Nuxt process
- [optional] Delete all directories
.nuxt,node_modules,yarn.lockandpackage.lock.json - Ensure you are using the latest node version (Node 10.x and NPM >= 5 are recommended)
- Upgrade
nuxt.config.js,modulesandserverMiddlewareto useimport/exportinstead ofrequire - Ensure webpack and vue dependencies are not explicitly set inside your
package.json, if so please upgrade them to match Nuxt used versions - Do
npm installoryarn install - [optional] Use
npm outdatedoryarn outdatedand manually update any other dependency with care - If you have a CDN deployment system, please make sure you have updated CI/CD configurations to publish
.nuxt/dist/clientinstead of.nuxt/dist - If you are using
build.extend, make sure your changes are compatible with Webpack 4.
Still Having problems? Make a bug report at CMTY or reach us using Discord
Major changes
- We now use Webpack 4. We announced 2.x and started publishing latest changes as
nuxt-edgepackage at March. But we wanted to make sure that most of the plugins were updated and stable before releasing a stable version of Nuxt.js - Due to server/client artifact isolation (PR #3758), external
build.publicPathneed to upload built content to.nuxt/dist/clientdirectory instead.nuxt/dist. - ESM is supported everywhere you can now use
export/importsyntax innuxt.config.js,serverMiddlewareandmodules. - Upgraded to use Babel 7 (PR #3667)
- Use
postcss-preset-envinstead ofpostcss-cssnext(notes) (PR #3291), configbuild.postcss.presetis forpostcss-preset-env options - Introducing nuxt-start for runtime only and nuxt-legacy to support Node < 8
- Due to
css-loaderupgrade, use~assetsinstead of~/assetsfor alias in<url> CSS data type, e.g.,background: url("~assets/banner.svg")(PR #3741)
Features
watchQuerylets you observe query strings and execute component methods (asyncData, fetch, validate, layout etc) on change (3d49d8d)- You can now Ignore pages with a prefix (PR #2594)
- Internal hooks can be set hierarchically in
nuxt.config.js(PR #3766) - Added
loading: falseoption to pages, see example, (PR #3629) - New stores modules can now be built by a combination of files (
actions.js,mutations.js,getters.jsandstate.js) along withindex.js(PR #3636) - Support functional filenames for webpack assets (PR #3787)
- Server middleware watchers support (PR #3718)
- HTTPS and Unix sockets support out of the box (PR #3831)
- Support
serveroption innuxt.config.jsto setHOSTandPORT(PRs #3701) - Support using
NUXT_HOST,NUXT_PORTenvironment variables (PR #3651) - Configure Vue directly in
nuxt.config.js(PR #3655) - Add preset option for postcss in
nuxt.config.js(PR #3734) - Make compression middleware customizable (#3863)
- Environment variables starting with
NUXT_ENV_will be automatically included inprocess.env(#3862) no-ssrhas been upgraded tovue-no-ssr 1.0.0, it supportsplaceholderTag
Enhancements
- Fix HTML script tag in core/renderer to remove W3C warning (PR #2971)
- Add
render:contexthook (PR #3294) - Replace
background-colortobackgroundinloadingIndicator(PR #3656), so you can use an image or some gradient for your background in SPA mode! - Correctly center
loadingIndicatorwhen using IE (PR #3779) - Add
watchoption to watch custom files to restart the Nuxt.js server (default:nuxt.config.jsandserverMiddlewarefiles) (PRs #3633 and #3718) - Isolate client and server artifacts (PR #3758) for better security of SSR bundles.
- Using webpackbar and consola for a sexier CLI experience and better CI compatibility.
- Change webpack asset names to names for development and to filehashes for production. (PR #3789). Also, prevent assets name collision in dev mode (Issue #3786)
- Call global Vue errorHandler in fetch and asyncData (PR #3652, #3781)
- Error page rendering before redirect (PR #3782)
- Disable template literals in lodash templates (PR #3753)
- Display proper error when the specified plugin isn't found (PR #3672)
- Customize the path to your
app.htmltemplate innuxt.config.js(PR #3678) - Quiet option when building your Nuxt app (PR #3705)
- Minify extracted CSS assets (#3857)
- Add tests to check for changed files (#3893)
- Overwrite
store.registerModuleto work seamlessly with SSR (#3909) - Add throttle option to skip progress for fast loads (#3886)
Deprecated
- The
vendorarray isn't used anymore because of Webpack 4 - We removed DLL support as it was not stable enough and Webpack 4 is much faster now.
- Obsolete AggressiveSplittingPlugin (PR #3545)
- The
render.gzipoption. Userender.compressorinstead.