The build option is used to customize the webpack configuration for building your Nuxt app the way you prefer. For example, you may want to install jQuery globally in your project so that you don't have to use import whenever you need it. You can automatically load jQuery by using webpack's ProvidePlugin function, as follows:
// nuxt.config.js
import webpack from 'webpack'
export default {
build: {
plugins: [
new webpack.ProvidePlugin({
$: "jquery"
})
]
}
}
We will use this build option again in Chapter 4, Adding Views, Routes, and Transitions, in Chapter 6, Writing Plugins and Modules, and in Chapter 14, Using Linters, Formatters, and Deployment Commands.
For more details and examples of things that you can do with this option for your Nuxt app, visit https://nuxtjs.org/api/configuration-build. For more information about webpack...