Skip to content

Commit

Permalink
build: fixed rollup config and disabled pino in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
mgordel committed Mar 5, 2024
1 parent f3106dc commit cf3c0f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";
import typescript from "@rollup/plugin-typescript";
import nodePolyfills from "rollup-plugin-polyfill-node";
import ignore from "rollup-plugin-ignore";
import pkg from "./package.json" assert { type: "json" };
import filesize from "rollup-plugin-filesize";

Expand All @@ -25,6 +26,7 @@ export default [
format: "es",
},
plugins: [
ignore(["pino"]),
nodeResolve({ browser: true, preferBuiltins: true }),
commonjs(),
nodePolyfills(),
Expand Down
6 changes: 5 additions & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Logger } from "@golem-sdk/golem-js";
import { GolemUserError, Logger } from "@golem-sdk/golem-js";
import * as pino from "pino";
import * as pinoPretty from "pino-pretty";
import { isBrowser } from "./utils";

class Pino implements Logger {
private logger: pino.Logger;
Expand All @@ -10,6 +11,9 @@ class Pino implements Logger {
child?: pino.Logger,
private namespace?: string,
) {
if (isBrowser) {
throw new GolemUserError("This pino logger implementation is not available from the browser");
}
this.logger = child || pino.pino(optionsOrStream);
}

Expand Down

0 comments on commit cf3c0f3

Please sign in to comment.