You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, readable-stream does not work with rollup (nodejs/readable-stream#348). There is, at the time of writing this, no one that is working on this problem. One workaround is to use builtin streams instead of readable-stream when rolling up. The test repository has a demonstration of this using rollup-plugin-replace.
Second, logform does not rollup. I'll be opening a second issue on that repository.
Finally, even if the above two were addressed, the final rolled up artifact is quite large. The test repository includes rollup-plugin-size-snapshot to give a sense of things. A minimal hello world using only the console transport comes in at 263KB.
Even though only the Console transport is being used both the File and Http transports are included in the bundle which indicates rollup is having trouble statically analyzing the file. It may be that there is a better way to import/require things in my test. This is the same sort of trouble that motivated moment to convert to luxon (although moment is more of a pure-browser library so size is more important).
git clone https://github.com/westonpace/winston-rollup-test
cd winston-rollup-test
npm install
npm run build
node bundle.cjs.js
What do you expect to happen instead?
I would expect a small working bundle to be generated with no warnings.
Other information
To be fair, I understand that winston is primarily a non-browser module and rollup is not a typical use case for such modules. Furthermore, the first two critical issues above are really issues with external libraries. However, I believe this information can be useful to others that are hoping to use rollup and running into problems with winston.
I understand if fixing these problems is a lower priority. Furthermore, once native ES6 support is more widespread (node 11) and more code bases move from require to import these problems should just sort of magically go away.
The text was updated successfully, but these errors were encountered:
may or may not be related, but I got blocked using rollup with winston too and the reason was that winston adds a "default" object property. When rollup does it's job with the commonjs plugin, it rewrites stuff to access default module exports with a direct notation (i.e. winston['default']) and of course this no longer points to the default export!
Please tell us about your environment:
winston
version?winston@2
winston@3.2.1
node -v
outputs:Not relevant but Linux
Plain JS
What is the problem?
I have created a minimal test repository here: https://github.com/westonpace/winston-rollup-test
First,
readable-stream
does not work with rollup (nodejs/readable-stream#348). There is, at the time of writing this, no one that is working on this problem. One workaround is to use builtin streams instead of readable-stream when rolling up. The test repository has a demonstration of this usingrollup-plugin-replace
.Second,
logform
does not rollup. I'll be opening a second issue on that repository.Finally, even if the above two were addressed, the final rolled up artifact is quite large. The test repository includes
rollup-plugin-size-snapshot
to give a sense of things. A minimal hello world using only the console transport comes in at 263KB.Even though only the Console transport is being used both the File and Http transports are included in the bundle which indicates rollup is having trouble statically analyzing the file. It may be that there is a better way to import/require things in my test. This is the same sort of trouble that motivated
moment
to convert toluxon
(although moment is more of a pure-browser library so size is more important).What do you expect to happen instead?
I would expect a small working bundle to be generated with no warnings.
Other information
To be fair, I understand that winston is primarily a non-browser module and rollup is not a typical use case for such modules. Furthermore, the first two critical issues above are really issues with external libraries. However, I believe this information can be useful to others that are hoping to use rollup and running into problems with winston.
I understand if fixing these problems is a lower priority. Furthermore, once native ES6 support is more widespread (node 11) and more code bases move from require to import these problems should just sort of magically go away.
The text was updated successfully, but these errors were encountered: