zalmoxisus / crossbuilder

Building web, Electron, Cordova and Chrome apps, and cross-browser extensions with React, Redux and Webpack. "Write once, deploy everywhere" concept in practice.
MIT License
484 stars 50 forks source link

Mixing import and require #26

Closed emschwartz closed 8 years ago

emschwartz commented 8 years ago

If I'm interpreting this correctly, I think these lines https://github.com/zalmoxisus/browser-redux/blob/master/src/app/store/configureStore.js#L9-L10 will only work with the add-module-exports plugin that is included in webpack/dev.config.js but not in webpack/prod.config.js.

zalmoxisus commented 8 years ago

Hey @emschwartz,

As tests pass, there are no problems in production. It works because we require those modules from inside (they aren't build as commonjs). In case we make them as independent npm packages, we'll have to use add-module-exports or to add .default when requiring. Likewise https://github.com/zalmoxisus/browser-redux/blob/master/src/app/store/configureStore.js#L21-L22.

emschwartz commented 8 years ago

I'm working on a modified version of the boilerplate so it may have been something wrong with my version. I ran into errors saying the module imported there wasn't a function because it wasn't handling the .default properly but never mind if it's not an issue for others