LouisBarranqueiro / reapop

:postbox: A simple and customizable React notifications system
https://louisbarranqueiro.github.io/reapop
MIT License
1.55k stars 78 forks source link

Webpack include React even if it in externals #18

Closed PredokMiF closed 7 years ago

PredokMiF commented 7 years ago

If I load React, Redux etc, as separete scripts and put it to externals in webpack.config.js, webpack all the same include it in to my bundle and I have: react.js and bundle.js (witn second React).

The problem in file /src/components/NotificationsContainer.js, line 2:import TransitionGroup from 'react/lib/ReactCSSTransitionGroup'; if I comment it, all works good.

I fix it on my side like this:


    'react': 'React',
    'react-dom': 'ReactDOM',
    'redux': 'Redux',
    'react-redux': 'ReactRedux',
    'react-router': 'ReactRouter',
    'redux-logger': 'reduxLogger',
    'redux-form': 'ReduxForm',
    'react/lib/ReactTransitionGroup': 'React.addons.TransitionGroup',
    'react/lib/ReactCSSTransitionGroup': 'React.addons.CSSTransitionGroup',
}```

But I think that it should be fixed on your side.
LouisBarranqueiro commented 7 years ago

Hey @PredokMiF, Try:

PredokMiF commented 7 years ago

Yes, I already made this, but it is only a hack, I think

LouisBarranqueiro commented 7 years ago

It's absolutely not a hack. Just the recommended way by Facebook: https://facebook.github.io/react/docs/animation.html

If it works, PR please

LouisBarranqueiro commented 7 years ago

got some news @PredokMiF ?

LouisBarranqueiro commented 7 years ago

Reapop v1.0.0 is released - Read breaking changes before update :)

PredokMiF commented 7 years ago

I fix it with webpack.DllPlugin: First bundle - 'react', 'react-dom', ..., 'reapop', 'reapop-theme-wybo', 'font-awesome/css/font-awesome.min.css' Second bundle - my own code. This plugin can combine librarys in bundle and separate it from your own source code. I like it )