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..02346f83dc 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,12 @@ -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',