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

Module parse failed error on Next.js 14 #156

Open
abdllhcay opened this issue Apr 17, 2024 · 2 comments
Open

Module parse failed error on Next.js 14 #156

abdllhcay opened this issue Apr 17, 2024 · 2 comments

Comments

@abdllhcay
Copy link

I got this error on my Next.js 14.0.4 app when I call logger like logger.info("Hello World");

./node_modules/@napi-rs/snappy-win32-x64-msvc/snappy.win32-x64-msvc.node
Module parse failed: Unexpected character '�' (1:2)
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)

Here is my logger.ts file.

import winston from "winston";
import LokiTransport from "winston-loki";

const { combine, timestamp, json } = winston.format;

const logger = winston.createLogger({
  level: "info",
  format: combine(timestamp(), json()),
  transports: [
    new winston.transports.Console({}),
    new LokiTransport({
      host: "http://127.0.0.1:3100",
      labels: {
        app: "my-app",
      },
    }),
  ],
});

export default logger;
@wuyiqunLu
Copy link

wuyiqunLu commented Apr 26, 2024

Experienced same issue on prod build, did you figure out the solution? @abdllhcay

@abdllhcay
Copy link
Author

Experienced same issue on prod build, did you figure out the solution? @abdllhcay

No, I couldn't find a solution. So I switched to using pino-loki.

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