-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add note about non ES6 usage #59
Comments
That's because I used webpack's bundling of requires rather than babel's. Your Same problem when you include it as a script tag. A bit annoying. For now the above method works but I'll look into whether webpack can do this too. I use webpack's require because for some reason, if I directly export UMD from babel, webpack doesn't know how to expose a |
I'm not explaining this very well lol. @nkbt probably knows this better than I do. |
Since it is all react anyways, isn't it better to simply transform
everything as separate files with babel and not use webpack?
Bower is another story, but who actually use it these days? If you still
wish to publish for bower, make an additional build.
|
Right, the only reason why I'm even bundling with webpack is for bower support. Thought it was convenient that I can kill two birds with one build. So, if we support bower/script tag, we still need that build, and that's the problem. |
Need 2 builds. Bower, sigh
|
I'm surprised to see react ppl using bower
|
I've gradually removed bower support for my other repos. But to be fair, maybe we're a bit in an echo chamber here. Some friends the other day told me they were still using script tags. Dunno about the intersection of people using bower/script tag and those using react-motion |
I can fix this stuff
|
Worst that you have to keep build artifact in repo for bower.
|
^ I know... that was one of the reasons I didn't want it. Lemme ask on Twitter or something. |
Yeah, let's support it, for now... |
This actually seems correct to me.
If you don't want that behavior, you can go back to using Not a Webpack issue, is it? |
Even Babel can't “make it work” on the export side. Babel does “interop import” on the import side: if you import an ES5-style module from Babel, it will “pretend” it has a default export. But it can't turn an ES6 module into something consumable by ES5 code without |
It's not a mistake, but Babel goes a step further and does exports["default"] = test;
module.exports = exports["default"]; After which you can use You know what, maybe there shouldn't be a default export for this library? |
Oh, you're right. |
We can have the excuse that I might expose a |
After all it's not just one component.. import { Spring } from 'react-motion' and var Spring = require('react-motion').Spring and everyone's happy |
You already have a |
Okay, the mystery of the Century revealed. This is why people still use bower - Rails! Going to explore some ways to support bower without checking in pre-built code into a repo. I'll make a PR if I come up with some reasonably good solution. |
I initially tried using the following code which didn't work:
The text was updated successfully, but these errors were encountered: