-
Notifications
You must be signed in to change notification settings - Fork 522
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
react and csstips use module syntax rollup doesn't understand #933
Comments
I found a working solution:
|
Having a similar problem with |
I use My tsconfig has the following flags which create the __importStar and __importDefault:
|
On my original problem, it seems to be something specific to this csstips library, and I suspect also may be due to a bug in either rollup or typescript. Another library from the same author as csstips works ok with the import *: Works with
Works with
The result of all this is with React and using that csstips library I can do either server-side-rendering without hydration from the rollup bundle, or no SSR and including the bundle normally, but not both SSR + hydrate ("isomorphic"). |
Seems like the Turning that off I see
Looking inside react-dom/index.js we see
I think rollup doesn't know how to peek inside this if block to follow the re-exported symbols |
It's failing, see discussion in bazel-contrib#933
I see that the rollup-replace-plugin is meant to be used |
It's failing, see discussion in bazel-contrib#933
Not surprised csstips has this problem too
rollup doesn't know how to do the partial evaluation to follow the re-export structure there |
rollup/rollup-plugin-node-resolve#58 describes our problem. This snippet in the rollup.config.js makes the react example work:
I think we are being strange here by bundling react into the output bundle. Maybe most sites leave it as a separate script tag coming from a CDN? |
It's failing, see discussion in bazel-contrib#933
Will probably close this once the new rollup_bundle is released, I don't see why this is bazel-specific. |
@alexeagle It would be still good to have an example rollup config on how to work with this though, right? |
Doesn't look like this is a bazel problem, we should be running rollup the same way you would outside bazel. |
🐞 bug report
Affected Rule
The issue is caused by the rule:
rollup_bundle
Is this a regression?
Unknown
Description
In a rolled up js file, the browser has an error where a * import was used:
Uncaught TypeError: undefined is not a function
My original ts code:
but the code where I used csstips has this in the es2015.js file:
My BUILD rules are like this:
The text was updated successfully, but these errors were encountered: