Skip to content

Using transport with file with Next.js #81

@GodDrinkTeJAVA

Description

@GodDrinkTeJAVA

While importing PinoWebpackPlugin in Next.config.js, next.js always shows the message for not having CommonJsRequireDependency.

When I push PinoWebpackPlugin into array of plugins by this clause where currDir is simply a variable for __dirname

config.plugins.push(new PinoWebpackPlugin({transports: [`${currDir}/src/modules/logger/transport.mjs`]}));

The error for dependency always occurs, regardless of my TS-baed project, or new JS-based project created by create-next-app. next build always fail, and dev-server throws error for it.

The message below is shown by error page:

Failed to compile
./node_modules/pino/browser.js
No template for dependency: CommonJsRequireDependency

The message below is shown by terminal running server:

No template for dependency: CommonJsRequireDependency
{"level":30,"time":1673234383826,"pid":23900,"hostname":"<MyDevice>.local","msg":"info logger"} # this is the log I've created
Could not find files for / in .next/build-manifest.json
Could not find files for / in .next/build-manifest.json
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/modules|javascript/dynamic|/Users/user/workspace/project/test/next-test/node_modules/pino/browser.js': No serializer registered for CommonJsRequireDependency
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> webpack/lib/NormalModule -> Array { 3 items } -> CommonJsRequireDependency

I've searched for the CommonJsRequireDependency error cases and haven't found any clue for it. If further information is needed, let me know by leaving a comment for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions