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

Transport js file is not generated unless I include a dummy import to the transport module #43

Closed
segevfiner opened this issue Jun 14, 2022 · 1 comment · Fixed by #45

Comments

@segevfiner
Copy link
Contributor

segevfiner commented Jun 14, 2022

With the following configuration:

index.ts
import pino from 'pino';
// import 'pino-pretty';

const logger = pino({level: 'info'}, pino.multistream([pino.transport({target: 'pino-pretty'})]));
logger.info("Test");
webpack.config.ts ///

import webpack from 'webpack';
import { PinoWebpackPlugin } from 'pino-webpack-plugin';

const config: webpack.Configuration = {
target: 'node',
mode: 'development',
devtool: 'eval-source-map',

entry: {
    index: './src/index.ts',
},

resolve: {
    extensions: ['.ts', '.js']
},

output: {
    library: {
        type: 'commonjs2'
    },
},

module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: /node_modules/,
        use: 'ts-loader',
      },
    ],
},

plugins: [
    new PinoWebpackPlugin({
        transports: ['pino-pretty']
    })
]

};

export default config;

tsconfig.json { "extends": "@tsconfig/node16/tsconfig.json", "include": ["src/**/*"], "compilerOptions": { "outDir": "dist", "sourceMap": true } }

Unless I uncomment the line in index.ts that imports pino-pretty, no pino-pretty.js file will be generated. This is not documented in the README and I believe shouldn't be required given we supply the plugin with a list of transports it should bundle.

@mcollina
Copy link
Member

@ShogunPanda wdyt?

ShogunPanda added a commit that referenced this issue Jun 16, 2022
* fix: Make sure transports are required. Fixes #43.

* test: Added test.

* chore: Run on supported Node.js versions.
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

Successfully merging a pull request may close this issue.

2 participants