mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-11 23:07:16 +00:00
c3e51a05af
In response to @husayt's [comment](https://github.com/nuxt/nuxt.js/pull/3480#issuecomment-404150387). HMR now works.
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
module.exports = {
|
|
/*
|
|
** Headers of the page
|
|
*/
|
|
head: {
|
|
title: 'web-worker',
|
|
meta: [
|
|
{ charset: 'utf-8' },
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
|
|
],
|
|
link: [
|
|
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
|
|
]
|
|
},
|
|
/*
|
|
** Customize the progress bar color
|
|
*/
|
|
loading: { color: '#3B8070' },
|
|
plugins: [
|
|
{ src: '~/plugins/inject-ww', ssr: false } // web workers are only available client-side, hence ssr: false
|
|
],
|
|
/*
|
|
** Build configuration
|
|
*/
|
|
build: {
|
|
/*
|
|
** Run ESLint on save
|
|
*/
|
|
extend (config, { isDev, isClient }) {
|
|
if (isDev && isClient) {
|
|
config.module.rules.push({
|
|
enforce: 'pre',
|
|
test: /\.(js|vue)$/,
|
|
loader: 'eslint-loader',
|
|
exclude: /(node_modules)/
|
|
})
|
|
}
|
|
|
|
// @see https://github.com/nuxt/nuxt.js/pull/3480#issuecomment-404150387
|
|
config.output.globalObject = "this"
|
|
|
|
if (isClient) { // web workers are only available client-side
|
|
config.module.rules.push({
|
|
test: /\.worker\.js$/, // this will pick up all .js files that ends with ".worker.js"
|
|
loader: 'worker-loader',
|
|
exclude: /(node_modules)/
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|