-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
chore(package): add browser
field that points to UMD build
#3566
Conversation
soederpop
commented
Apr 12, 2019
- uses expose-loader to do this
- added the umd build path as the browser property on package.json
💖 Thanks for opening this pull request! 💖 Here is a list of things that will help get it across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov Report
@@ Coverage Diff @@
## master #3566 +/- ##
=======================================
Coverage 99.81% 99.81%
=======================================
Files 174 174
Lines 2730 2730
=======================================
Hits 2725 2725
Misses 5 5 Continue to review full report at Codecov.
|
UMD build was already fixed, however thank you for your effort there ❤️ |
Please reconsider. For webpack you have to opt in with config.
here are the docs on how it is used https://github.com/defunctzombie/package-browser-field-spec Rollup also lets you opt into this: https://github.com/rollup/rollup-plugin-node-resolve So making this change won't effect anyone who uses these bundlers, except in the case that the developers make this very common config enhancement (or their boilerplate does) and then semantic-ui-react isn't able to help them optimize but the biggest benefit would be for tools like unpkg.com and other cdn's, who would know to link to the umd build by default. instead they redirect to the commonjs build which is obviously not usable in the browser. so it doesn't hurt anyone, and only helps the people who want it. Also, the UMD build is actually broken, despite the test saying otherwise <html>
<head>
<script src="https://unpkg.com/react@16.8.4/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16.8.4/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/semantic-ui-react@0.86.0/dist/umd/semantic-ui-react.min.js"></script>
<script>
alert(typeof window.semanticUIReact === 'undefined' ? 'Oh Crap' : 'Hmm')
</script>
</head>
<body>
<h1>hi</h1>
</body>
</html> see the result: tested on all browsers. used the file from the npm package, from unpkg.com, and built locally -- same error also, take a look at the UMD build's contents:
30% or more of the bundle is this kind of stuff, even though TerserPlugin is configured with comments set to false in the output. maybe the test isn't testing the same build you're actually distributing. |
Also I confirmed this bug did not exist until 0.85.0. 80-84 are all fine. I took the liberty of modifying your UMD test to include the UMD builds that have been published and the tests do fail starting at 0.85 and 0.86, but pass at 0.84 I do think there may be an issue between what your tests are actually testing, vs what you're distributing. |
Fix was not published yet, that's why it it's still broken. You can manually build master and get working UMD. I got your point, let's revert changes with |
Will do!
Sorry to bombard you I didn't realize that the master branch was ahead of the npm release even though the version numbers are the same. |
thanks a lot for reconsidering. removed the expose-loader. confirmed it works fine. apologies for the false alarm. |
browser
field that points to UMD build
* chore(package): remove `browser` field Reverts changes introduced in Semantic-Org#3566, fixes Semantic-Org#3597. * Update package.json