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

Error while building the next-9 example #10

Closed
vishwasnavadak opened this issue Feb 8, 2020 · 8 comments
Closed

Error while building the next-9 example #10

vishwasnavadak opened this issue Feb 8, 2020 · 8 comments

Comments

@vishwasnavadak
Copy link

Issue

Error while trying to install and build the example for installing next-pwa on Next v9+ .

Expected Output

Successful Build with PWA ready Next App

Steps

> next-pwa-example@1.0.0 build /<dir>/next-9
> next build

> [PWA] compile client (static)
> [PWA] auto register service worker with: /<dir>t/next-9/node_modules/next-pwa/register.js
> [PWA] service worker: /<dir>/next-9/public/sw.js
> [PWA]   url: /sw.js
> [PWA]   scope: /
> [PWA] precache manifest: /<dir>/next-9/public/precache.ykumYKjvIaxEuyzC-fB1q.[manifestHash].js
> [PWA] compile server
Creating an optimized production build

Failed to compile.

Please check your GenerateSW plugin configuration:
"importsDirectory" is not a supported parameter.. "globDirectory" is not a supported parameter.. "globPatterns" is not a supported parameter.. "precacheManifestFilename" is not a supported parameter.

> Build error occurred
Error: > Build failed because of webpack errors
    at build (/<dir>/next-9/node_modules/next/dist/build/index.js:10:900)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! next-pwa-example@1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the next-pwa-example@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /<dir>/.npm/_logs/2020-02-08T13_39_59_180Z-debug.log
@shadowwalker
Copy link
Owner

I will check this. Thanks for create this issue.

@shadowwalker
Copy link
Owner

shadowwalker commented Feb 10, 2020

@vishwasnavadak Hi, reproduce confirmed. This is due to an update to 5.0 in workbox, they deprecated some parameters and caused this breaking change. If this is important to you, please use next-pwa v2.0.2 for now. I will investigate if there is a good fix I can do.

@vishwasnavadak
Copy link
Author

@shadowwalker Sure will do. Thanks for the help

@shadowwalker
Copy link
Owner

@vishwasnavadak Hi, I just finished the fix. Could you try out the latest change? next-pwa v2.1.1 should be working as expected.

@vishwasnavadak
Copy link
Author

@shadowwalker That was a very quick fix. It works !!

Thank you!

@AkshayCloudAnalogy
Copy link

AkshayCloudAnalogy commented May 9, 2020

@shadowwalker Same issue is arising with v2.40
Here is the error:

yarn run v1.21.1
$ next build
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: <dir>\next-pwa\examples\next-9\node_modules\next-pwa\register.js
> [PWA] Service worker:<dir>\next-pwa\examples\next-9\public\sw.js
> [PWA]   url: \sw.js
> [PWA]   scope: \
> [PWA] Compile server
Creating an optimized production build  

Failed to compile.

chunk static/runtime/main.js [initial]
static/runtime/main-e2f6bbe4483af32f35ee.js
<dir>\next-pwa\examples\next-9\node_modules\next-pwa\register.js c41b81e2b7b93250b27effc664089e9b
Unterminated string constant (4:89)
|
| if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {
|   window.workbox = new __WEBPACK_MODULE_REFERENCE__0_576f726b626f78__("\sw.js", { scope: "\" })
|   if(true) window.workbox.register()
| }


> Build error occurred
Error: > Build failed because of webpack errors
    at build (<dir>\next-pwa\examples\next-9\node_modules\next\dist\build\index.js:13:900)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@AkshayCloudAnalogy
Copy link

AkshayCloudAnalogy commented May 9, 2020

Here is the error as it is not escaping \ if no scope is defined:

window.workbox = new workbox_window__WEBPACK_IMPORTED_MODULE_0__["Workbox"]("\sw.js", { scope: "\" }) <--- Here is error

@shadowwalker
Copy link
Owner

Fixed with commit
fc16e39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants