snappy
snappy copied to clipboard
Docs: Add a section to explain how to make it work with nextjs and/or webpack
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/@[email protected]/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/@[email protected]/node_modules/@napi-rs/snappy-darwin-arm64/snappy.darwin-arm64.node
../../node_modules/.pnpm/[email protected]/node_modules/snappy/index.js
../../node_modules/.pnpm/[email protected]/node_modules/winston-loki/src/batcher.js
../../node_modules/.pnpm/[email protected]/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
After implementing the node-loader, now I get these errors:
@GiancarlosIO -- did you ever get this to work? I'm facing the same problem trying to use nextjs + webpack.
See https://github.com/napi-rs/use-napi-rs-packages-with-bundlers