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

Rollup & ulog not working (no log output) #73

Open
canadaduane opened this issue Oct 25, 2021 · 3 comments
Open

Rollup & ulog not working (no log output) #73

canadaduane opened this issue Oct 25, 2021 · 3 comments

Comments

@canadaduane
Copy link

I can't seem to get rollup & ulog to work. My expectation is that I should install anylogger as a dependency and ulog as a devDependency, then import "ulog" followed by import anylogger from "anylogger" and create a log object that can be used to log strings. Unfortunately, there is no log message output.

I've written a repro so it can be easier to debug/give guidance:

https://github.com/canadaduane/ulog-test

Thanks.

@Download
Copy link
Owner

Download commented Apr 2, 2022

Just checking my repos again in some spare time in the weekend and noticed your issue. Very late I know but I am doing this unpaid and in my spare time...

I cloned your repo and ran it and was confused it did not work. Then I looked at the bundle.js and noticed something strange... It seems that the code for Node JS is being used i.s.o. the code for the browser.

Ulog is using the browser field in package.json and Webpack understands and respects that. Now it was my understanding that rollup also respects the same field, but it now seems it does not. I do not use rollup personally so I did not find this in testing.

There are actually 2 versions of the browser field. The first one is a very simple one where you can specify an alternative for main, like this:

{
  main: "src/node.js",
  browser: "src/browser.js"
}

However, this is not very flexible / powerful.
The second version of the spec allows you to give a mapping of individual files and their equivalents for the browser and that is what ulog is using.
I am pretty sure that rollup understands and respects the first version, because debug is using that and if that would not work with rollup, many people would be complaining. So maybe I have to do some refactoring and move mods to separate repos so they can all have their own package.json with a simple version 1 mapping of main to an alternative file....

It would be cool if you could do some investigation so that when I restart work on ulog, I will have some more information on this to inform what the best way forward is.

Thanks for reporting this issue to me. I will look at it again when I am ready to work on this project again.

@Download
Copy link
Owner

Download commented Apr 2, 2022

Maybe this is a bug in @rollup/plugin-node-resolve:
rollup/plugins#1098

@harinair
Copy link

harinair commented Jun 4, 2022

I guess I am also facing this issue... #66 may be related.

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

3 participants