From 9da9afd1fbedd6667dc9bd95f6e1368db6ff6625 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Mon, 5 Mar 2018 17:40:46 +0300 Subject: [PATCH 1/2] Fix umd build --- DayPicker.dist.js | 3 +-- DayPicker.js | 8 +------- src/DayPicker.js | 4 ---- src/index.js | 21 +++++++++++++++++---- webpack.config.js | 7 +++++++ 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/DayPicker.dist.js b/DayPicker.dist.js index fc769ab11e..d4b413e9ed 100644 --- a/DayPicker.dist.js +++ b/DayPicker.dist.js @@ -5,7 +5,6 @@ /* eslint-disable no-var */ /* eslint-env node */ -var DayPicker = require('./src/DayPicker').default; -DayPicker.Input = require('./src/DayPickerInput').default; +var DayPicker = require('./src').default; module.exports = DayPicker; diff --git a/DayPicker.js b/DayPicker.js index b51b70ca47..1379d64477 100644 --- a/DayPicker.js +++ b/DayPicker.js @@ -5,18 +5,12 @@ /* eslint-disable no-var */ /* eslint-env node */ -var DayPicker = require('./lib/src/DayPicker'); -var DateUtils = require('./lib/src/DateUtils'); -var LocaleUtils = require('./lib/src/LocaleUtils'); -var ModifiersUtils = require('./lib/src/ModifiersUtils'); +var DayPicker = require('./lib/src'); var Weekday = require('./lib/src/Weekday'); var Navbar = require('./lib/src/Navbar'); var PropTypes = require('./lib/src/PropTypes'); module.exports = DayPicker; -module.exports.DateUtils = DateUtils; -module.exports.LocaleUtils = LocaleUtils; -module.exports.ModifiersUtils = ModifiersUtils; module.exports.WeekdayPropTypes = Weekday.propTypes; module.exports.NavbarPropTypes = Navbar.propTypes; module.exports.PropTypes = PropTypes; diff --git a/src/DayPicker.js b/src/DayPicker.js index 2ff21cfee4..e1db271dc0 100644 --- a/src/DayPicker.js +++ b/src/DayPicker.js @@ -574,7 +574,3 @@ export default class DayPicker extends Component { ); } } - -DayPicker.DateUtils = DateUtils; -DayPicker.LocaleUtils = LocaleUtils; -DayPicker.ModifiersUtils = ModifiersUtils; diff --git a/src/index.js b/src/index.js index eae0c7022e..eca6466bc6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,17 @@ -export default from './DayPicker'; -export DateUtils from './DateUtils'; -export LocaleUtils from './LocaleUtils'; -export ModifiersUtils from './ModifiersUtils'; +import DayPicker from './DayPicker'; +import Input from './DayPickerInput'; +import * as DateUtils from './DateUtils'; +import * as LocaleUtils from './LocaleUtils'; +import * as ModifiersUtils from './ModifiersUtils'; + +DayPicker.Input = Input; +DayPicker.DateUtils = DateUtils; +DayPicker.LocaleUtils = LocaleUtils; +DayPicker.ModifiersUtils = ModifiersUtils; + +export { + DayPicker as default, + DateUtils, + LocaleUtils, + ModifiersUtils +} diff --git a/webpack.config.js b/webpack.config.js index f8bcb1e019..6c8a961682 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,8 @@ /* eslint global-require: 0, import/no-extraneous-dependencies: 0 */ /* eslint-env node */ +const webpack = require('webpack'); + const isProduction = process.env.NODE_ENV === 'production'; module.exports = { @@ -29,6 +31,11 @@ module.exports = { }, ], }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production') + }) + ], externals: { react: { root: 'React', From 591a28425ddbcbe8f1d3a18681d458cf8646ed1f Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Tue, 6 Mar 2018 16:57:01 +0300 Subject: [PATCH 2/2] Fix lint --- src/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index eca6466bc6..02346f83dc 100644 --- a/src/index.js +++ b/src/index.js @@ -9,9 +9,4 @@ DayPicker.DateUtils = DateUtils; DayPicker.LocaleUtils = LocaleUtils; DayPicker.ModifiersUtils = ModifiersUtils; -export { - DayPicker as default, - DateUtils, - LocaleUtils, - ModifiersUtils -} +export { DayPicker as default, DateUtils, LocaleUtils, ModifiersUtils };