Skip to content

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

Open
@GiancarlosIO

Description

From Brooooooklyn/snappy#119

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.

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

image

Thanks.

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

Checklist
  • Create src/snappyLoader.js6926d0a Edit
  • Running GitHub Actions for src/snappyLoader.jsEdit
  • Modify src/batcher.jse2dadcf Edit
  • Running GitHub Actions for src/batcher.jsEdit
  • Modify README.md0ddd1d5 Edit
  • Running GitHub Actions for README.mdEdit

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions