Skip to content
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

Replace env with production to fix umd crashing in runtime #637

Merged
merged 1 commit into from
Mar 4, 2018
Merged

Replace env with production to fix umd crashing in runtime #637

merged 1 commit into from
Mar 4, 2018

Conversation

TrySound
Copy link
Contributor

@TrySound TrySound commented Feb 24, 2018

Ref #632

Currently umd bundle just doesn't work.

  • added Input component everywhere
  • replace process.env.NODE_ENV with production to prevent crashing in umd bundle because prop types package does not exists.
  • simplified all entry points in favor of src/index.js

I think this can be published as minor.

before
daypicker.js 102.1K
daypicker.min.js 39.27K

after
daypicker.js 95.68K
daypicker.min.js 39.27K

@codecov
Copy link

codecov bot commented Feb 24, 2018

Codecov Report

Merging #637 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #637   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines         621    618    -3     
  Branches      133    133           
=====================================
- Hits          621    618    -3
Impacted Files Coverage Δ
src/DayPicker.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f8f528...2c19e81. Read the comment docs.

@TrySound
Copy link
Contributor Author

@gpbl Are you okay with this PR?

@TrySound
Copy link
Contributor Author

TrySound commented Mar 4, 2018

Ping? Currently umd is broken.

@gpbl
Copy link
Owner

gpbl commented Mar 4, 2018

Yeah this should work now. I guess all these complications were made (by me) because I didn't want to include the moment.js package.

@@ -29,6 +31,11 @@ module.exports = {
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
Copy link
Owner

@gpbl gpbl Mar 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in development this plugin should not be here. Dunno gotta merge it and see how it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UMD should not require build step, since it can be used in browsers. So NODE_ENV should be either production or development. Currently webpack adds process polyfill which sets NODE_ENV as undefined, so it's not production. But you excluded prop-types from umd and prop-types definitions are fails in runtime.

@gpbl gpbl merged commit eb9b906 into gpbl:master Mar 4, 2018
@TrySound TrySound deleted the fix-umd-env branch March 4, 2018 15:22
@gpbl
Copy link
Owner

gpbl commented Mar 5, 2018

Published as v7.1.0.

@TrySound TrySound mentioned this pull request Mar 5, 2018
kimamula pushed a commit to kimamula/react-day-picker that referenced this pull request Aug 17, 2022
Replace env with production to fix umd crashing in runtime
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.

2 participants