Dynamic requires are not currently supported by rollup-plugin-commonjs
See original GitHub issueWhen I use Rollup (https://rollupjs.org/) to bundle Winston, the following error is thrown when running the app:
node example/index.js
/Users/mike/logging/lib/bundle.js:21
throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
^
Error: Dynamic requires are not currently supported by rollup-plugin-commonjs
at commonjsRequire (/Users/mike/logging/lib/bundle.js:21:8)
at Function.get (/Users/mike/logging/lib/bundle.js:8108:31)
at _getConsoleLogFormat (/Users/mike/logging/lib/bundle.js:10777:10)
at _winstonConsole (/Users/mike/logging/lib/bundle.js:10792:13)
at getTransports (/Users/mike/logging/lib/bundle.js:10814:13)
at Object._init (/Users/mike/logging/lib/bundle.js:10820:17)
at Object.<anonymous> (/Users/mike/logging/example/index.js:4:23)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
The issue is caused by https://github.com/winstonjs/logform/blob/master/index.js#L27. Ideally, it’d be great to revert back to https://github.com/winstonjs/logform/commit/972dbece432dbda7a0aeae4c4a7ac8d549821a78#diff-168726dbe96b3ce427e7fedce31bb0bcL21. Although more verbose, it would open up Winston to being bundled by Rollup once https://github.com/winstonjs/winston/pull/1100 is merged.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to track down "Dynamic requires are not currently ...
I'm getting "Dynamic requires are not currently supported by rollup-plugin-commonjs" error in the runtime when I bundle and run my actual ...
Read more >Dynamic requires are not currently supported by rollup-plugin ...
I'm trying to figure out how I can include Handlebars import Handlebars from 'handlebars'; for use in my project using rollupjs. Any ideas?...
Read more >@rollup/plugin-commonjs - npm
Convert CommonJS modules to ES2015. Latest version: 24.0.0, last published: 14 days ago. Start using @rollup/plugin-commonjs in your project ...
Read more >rollup.js
By default, Rollup will expect config files to be ES modules and bundle and transpile them and their relative imports to CommonJS before...
Read more >How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Step 4: Add plugins to handle non-ES modules. This is important if any of your dependencies use Node-style modules. Without it, you'll get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is also a major issue when trying to integrate with https://github.com/zeit/pkg.
This issue also causes a slew of warnings (that then become runtime issues I have to assume, looking at the output files) with evanw/esbuild. It looks like my best workaround for the time being is to fork this repo and use https://classic.yarnpkg.com/en/docs/selective-version-resolutions/ to point at that fork?