-
Notifications
You must be signed in to change notification settings - Fork 361
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.config.js #655
Comments
This would break the core design principles of Microbundle in order to fix a bug in React, so it's not something I would consider. In terms of a solution to the problem you're tackling, you can alias react and react-dom to a module you write that imports React as a namespace and then re-exports it as named exports: microbundle --alias react=./react.js // react.js
import * as React from 'react';
const {
cloneElement,
createContext,
Component,
createElement
} = React;
export {
cloneElement,
createContext,
Component,
createElement
}; While it might seem a bit more verbose, it has the benefit of being code that actually runs according to the JS spec, rather than relying on a bundler configuration to violate the spec. I recall Pika provides an ESM react wrapper package that essentially does what I wrote above. I don't have the link handy but that would be a cleaner automated solution - just alias react to the name of their wrapper module and you can use both named and default exports. |
@developit Thanks man. Great Idea. I managed to solve this using externals instead.
I will keep the alias solution in mind for future! |
Awesome, sounds like the original problem is solved 🎉 |
One note to drop here - I do think it could be feasible to add a configuration file for Microbundle, but it would be similar to how Jest's works - a file for supplying the same parameters it currently accepts as command-line arguments. |
Works for me, but I chose to list |
Hi,
Is it possible to define a custom rollup.config.js ( even though microbundle is meant to be zero config )
I'm having the following issue compiling a typescript/material ui library requiring me
to add some options to the rollup.config :
Referenced from :
styled-components/styled-components#1654 (comment)
or
transitive-bullshit/react-modern-library-boilerplate#29
Cheers,
The text was updated successfully, but these errors were encountered: