Skip to content

Add UMD builds to Rollup#386

Merged
eddywashere merged 1 commit intoreactstrap:masterfrom
balloob:add-umd
Apr 3, 2017
Merged

Add UMD builds to Rollup#386
eddywashere merged 1 commit intoreactstrap:masterfrom
balloob:add-umd

Conversation

@balloob
Copy link
Copy Markdown
Contributor

@balloob balloob commented Apr 2, 2017

I incorrectly assumed that Webpack was exporting CommonJS syntax. Instead, it was exporting UMD format (which is CommonJS compatible).

So, this updates the Rollup config, also making it backwards compatible with Reactstrap 4.3.0 to address #359 (comment).

As extra bonus, the UMD bundles are able to be minified to 95kB! Looking at the source code, it seems like minifiers can do a better job minifying since everything is inside a function.

Changes:

  • Dropped reactstrap.cjs.js output
  • Added UMD bundle reactstrap.min.js (compatible with CommonJS and equivalent to output in Reactstrap 4.3)
  • Added source maps back

image

Testing changes

Point all the test files at the UMD bundle:

sed -i "" "s/\.\.\/\'/\.\.\/\.\.\/dist\/reactstrap.min'/" src/__tests__/*.spec.js

Run tests as usual: npm test.

@virgofx
Copy link
Copy Markdown
Collaborator

virgofx commented Apr 3, 2017

Thanks, looking forward to next release to test 👍

@eddywashere eddywashere merged commit 5461049 into reactstrap:master Apr 3, 2017
@balloob balloob deleted the add-umd branch April 3, 2017 05:46
@virgofx
Copy link
Copy Markdown
Collaborator

virgofx commented Apr 5, 2017

4.5.0 works great now and existing CDN reference on main site can remain as is. Thanks for the UMD update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants