Last active
December 22, 2020 14:34
-
-
Save davestewart/39c9594ef69bbf9c1a1cdb4983e30eeb to your computer and use it in GitHub Desktop.
Nuxt build config to provide sane source maps and reliable HMR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @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