Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register-service-worker 1.7.0 broke PWA plugin #2222

Closed
sinedied opened this issue Mar 13, 2020 · 6 comments · Fixed by #2229 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Closed

register-service-worker 1.7.0 broke PWA plugin #2222

sinedied opened this issue Mar 13, 2020 · 6 comments · Fixed by #2229 · May be fixed by adamlaska/osmos-cosmos-sdk#5
Labels
has PR Has a related PR has workaround Has a workaround topic: plugins Relates to VuePress plugins type: bug Something isn't working

Comments

@sinedied
Copy link

Using version 1.3.0 my website was building fine, no issues.
Just before updating, npm outdated shows this:

Package                               Current  Wanted  Latest  Location
@vuepress/plugin-active-header-links    1.3.0   1.3.1   1.3.1  nitro-workshop
@vuepress/plugin-google-analytics       1.3.0   1.3.1   1.3.1  nitro-workshop
@vuepress/plugin-medium-zoom            1.3.0   1.3.1   1.3.1  nitro-workshop
@vuepress/plugin-pwa                    1.3.0   1.3.1   1.3.1  nitro-workshop
vuepress                                1.3.0   1.3.1   1.3.1  nitro-workshop

After running npm update, I get this error when building the website:


✔ Client
  Compiled successfully in 9.40s

✔ Server
  Compiled successfully in 6.26s

wait Rendering static HTML...
Rendering page: /conclusion.html(node:10251) UnhandledPromiseRejectionWarning: ReferenceError: window is not defined
    at server-bundle.js:10716:53
    at new Promise (<anonymous>)
    at Module.<anonymous> (server-bundle.js:10716:20)
    at __webpack_require__ (server-bundle.js:27:30)
    at Object.<anonymous> (server-bundle.js:6777:18)
    at __webpack_require__ (server-bundle.js:27:30)
    at server-bundle.js:118:18
    at Object.<anonymous> (server-bundle.js:121:10)
    at evaluateModule (/Users/sinedied/projects/workshops/nitro-api/node_modules/vue-server-renderer/build.dev.js:9318:21)
    at /Users/sinedied/projects/workshops/nitro-api/node_modules/vue-server-renderer/build.dev.js:9376:18
    at new Promise (<anonymous>)
    at /Users/sinedied/projects/workshops/nitro-api/node_modules/vue-server-renderer/build.dev.js:9368:14
    at Object.renderToString (/Users/sinedied/projects/workshops/nitro-api/node_modules/vue-server-renderer/build.dev.js:9544:9)
    at Build.renderPage (/Users/sinedied/projects/workshops/nitro-api/node_modules/@vuepress/core/lib/node/build/index.js:157:34)
    at Build.render (/Users/sinedied/projects/workshops/nitro-api/node_modules/@vuepress/core/lib/node/build/index.js:94:33)
    at async App.build (/Users/sinedied/projects/workshops/nitro-api/node_modules/@vuepress/core/lib/node/App.js:498:5)
(node:10251) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10251) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
wait Generating service worker...

Removing @vuepress/pwa plugin from my config removes the error, so it seems something went wrong in the 1.3.1 update.

@sinedied
Copy link
Author

Adding a bit more details: only updating the vuepress package from 1.3.0 to 1.3.1 produce the same issue, so it seems to be related to the core package update.

@Unbinilium
Copy link

Seem the same issue here:

(node:1845) UnhandledPromiseRejectionWarning: ReferenceError: window is not defined
    at server-bundle.js:3899:53
    at new Promise (<anonymous>)
    at Module.<anonymous> (server-bundle.js:3899:20)
    at __webpack_require__ (server-bundle.js:27:30)
    at Object.<anonymous> (server-bundle.js:1830:18)
    at __webpack_require__ (server-bundle.js:27:30)
    at server-bundle.js:118:18
    at Object.<anonymous> (server-bundle.js:121:10)
    at evaluateModule (/Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/vue-server-renderer/build.dev.js:9318:21)
    at /Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/vue-server-renderer/build.dev.js:9376:18
    at new Promise (<anonymous>)
    at /Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/vue-server-renderer/build.dev.js:9368:14
    at Object.renderToString (/Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/vue-server-renderer/build.dev.js:9544:9)
    at Build.renderPage (/Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/@vuepress/core/lib/node/build/index.js:157:34)
    at Build.render (/Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/@vuepress/core/lib/node/build/index.js:94:33)
    at async App.build (/Users/runner/runners/2.165.2/work/Book-backup/Book-backup/node_modules/@vuepress/core/lib/node/App.js:498:5)
(node:1845) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1845) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Related with the pwa plugin, version detail:

    "@vuepress/plugin-active-header-links": "^1.3.1",
    "@vuepress/plugin-pwa": "^1.3.1",
    "@vuepress/plugin-search": "^1.3.1",
    "core-js": "^3.6.4",
    "less": "^3.11.1",
    "less-loader": "^5.0.0",
    "markdown-it-html5-embed": "^1.0.0",
    "minimist": "^1.2.5",
    "vuepress": "^1.3.1",
    "vuepress-plugin-clean-urls": "^1.1.1",
    "vuepress-plugin-copyright": "^1.0.2",
    "vuepress-plugin-mathjax": "^1.2.8",
    "vuepress-plugin-nprogress": "^1.1.6",
    "vuepress-plugin-smooth-scroll": "^0.0.9"

@meteorlxy
Copy link
Member

Please provide reproduce repo.

The official docs works well.

@meteorlxy meteorlxy added the needs reproduction Waiting for a reproduction link (codepen, code sandbox, GH repos) label Mar 18, 2020
@sinedied
Copy link
Author

Here's a repo with the issue: https://github.com/nitro-stack/nitro-workshop
After cloning, just run npm install && npm update && npm run build to reproduce.

@meteorlxy
Copy link
Member

meteorlxy commented Mar 18, 2020

It's not related to vuepress.

It's caused by [email protected], which introduces potential breaking changes.

yyx990803/register-service-worker@5f96e33#diff-1fdf421c05c1140f6d71444ea2b27638R24-R26

Workaround: lock version of register-service-worker to ~1.6.2

@meteorlxy meteorlxy added has workaround Has a workaround topic: plugins Relates to VuePress plugins type: bug Something isn't working and removed needs reproduction Waiting for a reproduction link (codepen, code sandbox, GH repos) labels Mar 18, 2020
@Unbinilium
Copy link

Please provide reproduce repo.

The official docs works well.

Here’s repo https://github.com/Unbinilium/issue, both npm install && npm run docs:build and yarn install && yarn docs:build reproduce.

And use npm ci still reproduce, both on ubuntu-latest on github actions and my macOS 10.15.3, npm version 6.14.2 and yarn version 1.22.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR Has a related PR has workaround Has a workaround topic: plugins Relates to VuePress plugins type: bug Something isn't working
Projects
None yet
3 participants