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

lazy-load does not play well with nexe #66

jd-carroll opened this issue Dec 3, 2018 · 6 comments

lazy-load does not play well with nexe #66

jd-carroll opened this issue Dec 3, 2018 · 6 comments


Copy link

@jd-carroll jd-carroll commented Dec 3, 2018

We are facing an issue using this module with a nexe bundled project. Essentially nexe does not support any type of dynamic module imports.

Is there any specific reason why the transports are setup lazily?

Copy link

@marcelfalliere marcelfalliere commented Jan 31, 2019

Same here. Our project bundle with parcel has problem starting because it cannot find colorize because it is imported dynamicly by logform. Culprit piece of code :

 * @api private
 * method {function} exposeFormat
 * Exposes a sub-format on the main format object
 * as a lazy-loaded getter.
function exposeFormat(name, path) {
  path = path || name;
  Object.defineProperty(format, name, {
    get() {
      return require(`./${path}.js`);
    configurable: true

Parcel does not support dynamic loading. Anyway, just pilling up on @jd-carroll issue.

Copy link

@iameli iameli commented May 1, 2019

Hm yeah. Winston is quite useful for running in a variety of environments, it's a shame that it can't be built with Parcel and such.

Copy link

@DABH DABH commented May 1, 2019

logform / winston specify browser fields in package.json which is what bundlers like webpack use instead of the main fields. The versions of the files in browser do not use dynamic imports and so should be fine for your use cases
However, it seems parcel, nexe, etc. (I am not hip with all the bundlers unfortunately) are preferring the main field instead of the browser field, which feels like a bug with them since this is exactly what that field was intended for. Do you know if those bundlers have a similar/analogous field we should be setting in our package.json's? Or is there a way to make them not ignore browser?

Copy link

@DABH DABH commented May 23, 2019

Potentially fixed in winstonjs/winston#1640 but need to test...

Copy link

@JakeDluhy JakeDluhy commented Aug 22, 2019

Not sure if this helps anyone, but I was having this problem using winston with electron (specifically from the main process, not the renderer). I was able to fix it by adding

resolve: {
  alias: {
    logform$: path.resolve(__dirname, 'node_modules', 'logform', 'dist', 'browser'),

to my main process webpack config.

Copy link

@55Cancri 55Cancri commented Apr 4, 2020

Any update to this using parcel? I am using aws-cdk with parcel-bundler@^1 and failing for all format functions including combine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

6 participants