Skip to content

Instantly share code, notes, and snippets.

@davestewart
Last active December 22, 2020 14:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davestewart/39c9594ef69bbf9c1a1cdb4983e30eeb to your computer and use it in GitHub Desktop.
Save davestewart/39c9594ef69bbf9c1a1cdb4983e30eeb to your computer and use it in GitHub Desktop.
Nuxt build config to provide sane source maps and reliable HMR
// @see https://twitter.com/dave_stewart/status/1332340558069690371
// Special thanks to https://github.com/nicholasoxford
// YMMV!
module.exports = {
build: {
extend (config, { isDev, isClient }) {
if (isDev) {
// provides proper source and properly-named source map for pages and components
config.devtool = 'source-map'
// provides sane HMR
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /node_modules/,
options: {
fix: true,
cache: true,
}
})
}
}
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment