From 48f40d51a719701016e6618195fcc3c49f028ae4 Mon Sep 17 00:00:00 2001 From: Adam McKee Date: Thu, 20 Jul 2017 23:48:07 -0600 Subject: [PATCH] Don't bundle create-react-class & allow Formsy to be used globally again. --- src/Decorator.js | 2 +- src/HOC.js | 2 +- src/main.js | 2 +- webpack.production.config.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Decorator.js b/src/Decorator.js index 4bff27a7..ae9f565a 100644 --- a/src/Decorator.js +++ b/src/Decorator.js @@ -1,5 +1,5 @@ var React = global.React || require('react'); -var createReactClass = require('create-react-class'); +var createReactClass = global.createReactClass || require('create-react-class'); var Mixin = require('./Mixin.js'); module.exports = function () { return function (Component) { diff --git a/src/HOC.js b/src/HOC.js index 15255c1e..b60582a5 100644 --- a/src/HOC.js +++ b/src/HOC.js @@ -1,5 +1,5 @@ var React = global.React || require('react'); -var createReactClass = require('create-react-class'); +var createReactClass = global.createReactClass || require('create-react-class'); var Mixin = require('./Mixin.js'); module.exports = function (Component) { return createReactClass({ diff --git a/src/main.js b/src/main.js index 27ee7276..a579ac4d 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,6 @@ var PropTypes = require('prop-types'); var React = global.React || require('react'); -var createReactClass = require('create-react-class'); +var createReactClass = global.createReactClass || require('create-react-class'); var Formsy = {}; var validationRules = require('./validationRules.js'); var formDataToObject = require('form-data-to-object'); diff --git a/webpack.production.config.js b/webpack.production.config.js index 4826ea84..bb0fde1e 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -4,7 +4,7 @@ module.exports = { devtool: 'source-map', entry: path.resolve(__dirname, 'src', 'main.js'), - externals: 'react', + externals: [ 'react', 'create-react-class' ], output: { path: path.resolve(__dirname, 'release'), filename: 'formsy-react.js',