Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help the developpers to detect that there is 2 reducer with same name/prefix #79

Open
fabienjuif opened this issue Jan 8, 2018 · 6 comments

Comments

@fabienjuif
Copy link
Member

Only in development builds:

  • use a global variable to register all tuples (name, prefix)
  • detect if there is a collision
  • if there is a collision, print a warning (error ?) message, something like: [k-redux-factory] You combined two reducers with same name and prefix, we think this is a bug. You should look at 'prefix' option to create your reducer(s)!

@bpetetot are you ok ?

This is related to #73 that is coming back on a regular basis

@bpetetot
Copy link
Collaborator

bpetetot commented Jan 8, 2018

Yes it seems good to me and useful to avoid problems to avoid name collisions

@fabienjuif
Copy link
Member Author

@bpetetot do you know how to handle dev/prod build from a library perspective ?

@bpetetot
Copy link
Collaborator

In ReactJS, they build 2 differents bundles: react.development.js and react.production.js
With the following index.js file:

'use strict';

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

@fabienjuif
Copy link
Member Author

Hmm ok, so we have to build 2 times the libs:

  • NODE_ENV=production yarn build
  • NODE_ENV=development yarn build

And add this index.js manually

@bpetetot
Copy link
Collaborator

I think you can directly build dev and prod bundles through the rollup config. So you will not have to call 2 times the yarn build command.

@fabienjuif
Copy link
Member Author

I move the lib to microbundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants