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

Docs: Add a section to explain how to make it work with nextjs and/or webpack #119

Open
GiancarlosIO opened this issue Mar 2, 2023 · 3 comments

Comments

@GiancarlosIO
Copy link

GiancarlosIO commented Mar 2, 2023

Hi there

I'm using nextjs and winston-loki which has snappy has a peerDependency, and I'm getting the following error:

error - ../../node_modules/.pnpm/@napi-rs+snappy-darwin-arm64@7.1.1/node_modules/@napi-rs/snappy-darwin-arm64/snappy.darwin-arm64.node
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently, no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

Import trace for requested module:
../../node_modules/.pnpm/@napi-rs+snappy-darwin-arm64@7.1.1/node_modules/@napi-rs/snappy-darwin-arm64/snappy.darwin-arm64.node
../../node_modules/.pnpm/snappy@7.1.1/node_modules/snappy/index.js
../../node_modules/.pnpm/winston-loki@6.0.6/node_modules/winston-loki/src/batcher.js
../../node_modules/.pnpm/winston-loki@6.0.6/node_modules/winston-loki/index.js
../../packages/next/dist/logger/index.js
../../packages/next/logger/index.mjs
./src/views/Homepage/server/getServerSideProps.tsx
./src/views/Homepage/index.ts

I think the error is because nextjs/webpack doesn't know how to process a file with an extension .node.
Maybe we can add, in the readme file, a section about how to fix this problem? 🤔 I have found this webpack-loader but I don't know if this is the recommended way.

Thanks.

SO: macOS
package manager: pnpm v7.18.0
winston: "v3.8.2",
winston-loki: "v6.0.6"
snappy: 7.1.1

@GiancarlosIO
Copy link
Author

After implementing the node-loader, now I get these errors:

image

@kenirwin
Copy link

kenirwin commented Mar 6, 2024

@GiancarlosIO -- did you ever get this to work? I'm facing the same problem trying to use nextjs + webpack.

@Brooooooklyn
Copy link
Owner

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