Updated Webworker example to work with nuxt.js 2.0 (#3531)

In response to @husayt's [comment](https://github.com/nuxt/nuxt.js/pull/3480#issuecomment-404150387).

HMR now works.
This commit is contained in:
Jon Ege Ronnenberg 2018-07-18 13:15:37 +02:00 committed by Clark Du
parent cfe1865905
commit c3e51a05af
2 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,9 @@ module.exports = {
}) })
} }
// @see https://github.com/nuxt/nuxt.js/pull/3480#issuecomment-404150387
config.output.globalObject = "this"
if (isClient) { // web workers are only available client-side if (isClient) { // web workers are only available client-side
config.module.rules.push({ config.module.rules.push({
test: /\.worker\.js$/, // this will pick up all .js files that ends with ".worker.js" test: /\.worker\.js$/, // this will pick up all .js files that ends with ".worker.js"

View File

@ -11,10 +11,13 @@
"precommit": "npm run lint" "precommit": "npm run lint"
}, },
"dependencies": { "dependencies": {
"nuxt": "^1.4.1" "nuxt-edge": "^2.0.0-25523369.7c85202"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^8.2.6",
"eslint": "^5.1.0",
"eslint-loader": "^2.0.0", "eslint-loader": "^2.0.0",
"eslint-plugin-vue": "^4.5.0",
"worker-loader": "^1.1.1" "worker-loader": "^1.1.1"
} }
} }