Nuxt/examples/web-worker/nuxt.config.js

53 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-03-18 00:45:52 +00:00
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"
2018-03-18 00:45:52 +00:00
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)/
})
}
}
}
}