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

Plugin is not working with next 10.0.6 and webpack 5 #270

Closed
adam187 opened this issue Feb 4, 2021 · 6 comments
Closed

Plugin is not working with next 10.0.6 and webpack 5 #270

adam187 opened this issue Feb 4, 2021 · 6 comments

Comments

@adam187
Copy link
Contributor

adam187 commented Feb 4, 2021

Hey,

I faced an issue after upgrading to [email protected]

Looks like it's a problem with https://www.npmjs.com/package/workbox-webpack-plugin so probably upgrade to version 6 could solve it, I'm not sure if that already changed it but probably yes.

{ Error: Cannot find module 'webpack' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/Users/adam/Projects/mf/next-offline-example/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js:12:5) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (/Users/adam/Projects/mf/next-offline-example/node_modules/workbox-webpack-plugin/build/generate-sw.js:24:43) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) code: 'MODULE_NOT_FOUND' }

Here is a related issue on the next.js side
vercel/next.js#21679

Here is reproduction:
https://github.com/adam187/next-offline-example

I can help with migrating if needed but would rather have some inside from the author first :)

@hanford
Copy link
Owner

hanford commented Feb 4, 2021

I haven't looked at whats new in Workbox 6, but would love to upgrade!

@SalahAdDin
Copy link

SalahAdDin commented Feb 28, 2021

@hanford @adam187
I'm getting the same problem with 10.0.7:

$ next dev
Loaded env from /Users/luisalaguna/Projects/portfolio/frontend/.env.development
Error: Cannot find module 'webpack'
Require stack:
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/index.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next-offline/index.js
- /Users/luisalaguna/Projects/portfolio/frontend/next.config.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/next-server/server/config.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/next-server/server/next-server.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/server/next.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/server/lib/start-server.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/cli/next-dev.js
- /Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js:12:5)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/generate-sw.js:24:43)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/generate-sw.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/workbox-webpack-plugin/build/index.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next-offline/index.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/next.config.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/next-server/server/config.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/next-server/server/next-server.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/server/next.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/server/lib/start-server.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/cli/next-dev.js',
    '/Users/luisalaguna/Projects/portfolio/frontend/node_modules/next/dist/bin/next'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@robschwitzer
Copy link

10.0.4 seeing this as well

$ NODE_ENV=production next build
Loaded env from /Users/a/b/c/.env.production

> Build error occurred
Error: Cannot find module 'webpack'
Require stack:
- /Users/a/b/c/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js
- /Users/a/b/c/node_modules/workbox-webpack-plugin/build/generate-sw.js
- /Users/a/b/c/node_modules/workbox-webpack-plugin/build/index.js
- /Users/a/b/c/node_modules/next-offline/index.js
- /Users/a/b/c/next.config.js
- /Users/a/b/c/node_modules/next/dist/next-server/server/config.js
- /Users/a/b/c/node_modules/next/dist/build/index.js
- /Users/a/b/c/node_modules/next/dist/cli/next-build.js
- /Users/a/b/c/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.<anonymous> (/Users/a/b/c/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js:12:5)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.<anonymous> (/Users/a/b/c/node_modules/workbox-webpack-plugin/build/generate-sw.js:24:43)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/a/b/c/node_modules/workbox-webpack-plugin/build/lib/get-manifest-entries-from-compilation.js',
    '/Users/a/b/c/node_modules/workbox-webpack-plugin/build/generate-sw.js',
    '/Users/a/b/c/node_modules/workbox-webpack-plugin/build/index.js',
    '/Users/a/b/c/node_modules/next-offline/index.js',
    '/Users/a/b/c/next.config.js',
    '/Users/a/b/c/node_modules/next/dist/next-server/server/config.js',
    '/Users/a/b/c/node_modules/next/dist/build/index.js',
    '/Users/a/b/c/node_modules/next/dist/cli/next-build.js',
    '/Users/a/b/c/node_modules/next/dist/bin/next'
  ]
}
error Command failed with exit code 1.

@hanford
Copy link
Owner

hanford commented Mar 6, 2021

Hmmm, it's working on my personal website which is on next 10.0.5, but it seems to stop working on newer versions...

@adam187
Copy link
Contributor Author

adam187 commented Mar 6, 2021

Looks like it's no longer an issue with 10.0.8

@adam187 adam187 closed this as completed Mar 6, 2021
@dman777
Copy link

dman777 commented Jul 8, 2021

I am hitting this issue with 10.0.8

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

5 participants