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

Importing this package breaks Next.js build #109

Open
nemanjam opened this issue Jun 15, 2023 · 1 comment
Open

Importing this package breaks Next.js build #109

nemanjam opened this issue Jun 15, 2023 · 1 comment

Comments

@nemanjam
Copy link

In next.config.js it's enough to import this plugin and it breaks the build.

// next.config.js

const { PinoWebpackPlugin } = require("pino-webpack-plugin");
username@computer3:~/Desktop/pino-webpack-test$ yarn dev
yarn run v1.22.19
$ next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- error Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Cannot find module 'webpack/lib/dependencies/CommonJsRequireDependency'
Require stack:
- /home/username/Desktop/pino-webpack-test/node_modules/pino-webpack-plugin/src/index.js
- /home/username/Desktop/pino-webpack-test/next.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at /home/username/Desktop/pino-webpack-test/node_modules/next/dist/server/require-hook.js:189:36
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/username/Desktop/pino-webpack-test/node_modules/pino-webpack-plugin/src/index.js:2:35)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12) {
  type: 'Error',
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/username/Desktop/pino-webpack-test/node_modules/pino-webpack-plugin/src/index.js',
    '/home/username/Desktop/pino-webpack-test/next.config.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
username@computer3:~/Desktop/pino-webpack-test$ 

Here is the same test case from another issue, but I get the same error in other latest Next.js project.

https://github.com/nemanjam/pino-webpack-test

@archcorsair
Copy link

I'm experiencing this issue with "next": "^14.1.0"

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

2 participants