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
browserify attempts to load all language files #79
Comments
But it also reverse the fix for #62 😕 |
Perhaps there is a way of implementing #62 without putting it in the module definition? Can we make a loader function that then uses the appropriate loader for the framework? |
Minor variable declaration change to make browserify happy. Fixes BenjaminVanRyseghemGH-79.
Submitted a PR for a trivial patch to check I know browserify uses "browser" and I don't know for certain about WebPack but I don't think it uses "node". I don't think this is an ideal solution to the overall problem - it just punts it to another day but gets browserify folks back up and running without breaking #62. |
@BenjaminVanRyseghem have you had the chance to give this topic any further thought? I'd like to get a solution going that goes in the right direction for everyone and the project in general. |
the It's better to have a half ugly working solution than a theoretical perfect not working solution 😄 Then maybe the browserify users have more input on this? |
Agreed, like I said, it's a punt. The issue with the module definition is that Node.js specific code got placed in a CommonJS section. This would theoretically break all CommonJS module loaders that aren't Node.js. Browserify (#70) and WebPack (#74) (CommonJS implementers) are clearly broken because of this. I feel like I'm taking this issue off topic though. My point of this issue was to address all languages modules being loaded when using a CommonJS implementation. That should not be done on the client, and in my opinion it should not be done in the general case. I think a language loading function is a superior solution. It's hardly troublesome to have users specify which locales they would like to load in addition to the default en_XX locale. I envision something like the following: var numbro = require('numbro').includeLocales([ 'jp_JP', 'de_DE' ]); // loads just Japanese and German locales
var numbro = require('numbro').includeAllLocales(); // loads all locales, can be an alias to includeLocales() |
yep, it looks like this whole part was a hack to have it out, but it feels like it's time to have a look at it now 😄 your API proposal sounds good to me 😄 , if you want to propose a PR going in this direction, that will be awesome 😄 |
I'll see what I can do, I have a feeling it'll take some time to fix all the tests etc. Is anyone else working towards a solution for this? |
I can help if you want, but I have really little time available those days (I created a Gitter room for numbro if you want to discuss there) |
#71 seems to related as well. |
can you check that #101 fixes this issue? |
I can confirm that this issue is resolved by #101. |
The patch in #66 automatically loads all language files for any commonjs scenario, browserify included.
While I can't really complain about doing this on the server with Node.js, doing this in the browser adds unnecessary bloat that I can't easily remove.
Possible solutions off the top of my head:
As a side effect, this might help with #70.
The text was updated successfully, but these errors were encountered: