Optimize CommonJS and module build#477
Merged
eddywashere merged 4 commits intoreactstrap:masterfrom Jun 28, 2017
Merged
Conversation
Member
|
@balloob thanks! can you fix conflicts? |
51fef2f to
d2feccf
Compare
TheSharpieOne
approved these changes
Jun 27, 2017
Contributor
Author
|
@eddywashere done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR will split our Rollup config in two: one for the CJS/ES build and one for UMD. This is a backwards compatible change. It will also address the minimized name issue that people experienced in Storybook.
Bundled output (names link to the actual output):
lib- babelified source, stays the samedist/reactstrap.cjs.js- unminified CommonJS build, pointed at frompackage.maindist/reactstrap.es.js- unminified Module build, pointed at frompackage.moduledist/reactstrap.min.js- minified UMD build, to be included by users directlyThe CJS/ES builds will not include any dependency and will not be minimized. These builds are going to be consumed by other bundlers and thus will be minimized when bundled for production (if the user chooses so). These bundles will be returned when
require('reactstrap')orimport Reactstrap from 'reactstrap';.If you want to cherry pick only specific components:
With CommonJS:
const Card = require('reactstrap/lib/Card');With modules:
import { Card } from 'reactstrap';The UMD build is meant to be included directly on a webpage and will include the dependencies but not the peer dependencies. I've added a check so that when people add a peer dependency but not add it to the UMD globals object, it will fail the build.
This PR includes #474 as it was needed to generate correct builds.
CC @TheSharpieOne
Testing
To update source to run tests against the CommonJS build:
To update source to run tests against the module build:
To update source to run tests against the UMD build: