ibm-js / ecma402

ECMA-402 JavaScript Internationalization API "shim"
Other
34 stars 21 forks source link

Work as a node.js module? #64

Open srl295 opened 10 years ago

srl295 commented 10 years ago

I didn't investigate this much, but it looks like the library can't load under node (define is not defined). Is it possible?

srl295 commented 10 years ago

Think the answer may lie in adding requirejs boilerplate or using amintercept

rxaviers commented 10 years ago

Hey @srl295, someone from the project might give a better answer, but as I can tell this implementation uses pure AMD modules. So, you need to use an AMD loader (eg. amd-loader). Although, I'm not sure how to deal with the json plugins.

In order to avoid such dependency and to get Node.js supported natively, the distribution files could be UMD wrapped.

srl295 commented 10 years ago

@rxaviers Hi! Nice to see you here also besides ICU! amd-loader looks pretty easy to use. Wonder if just adding the right npm-visible stuff to this project (maybe a node-intl.js or something that just has require('amd-loader'); global.exports = require('./Intl') or something like that?

JCEmmons commented 10 years ago

I'm hoping @clmath can give me some guidance here. We do want the package to work properly under Node.js.

cjolif commented 10 years ago

I think there are two things here, the packaging for which UMD (see @rxaviers link) is probably the solution we want to go with and the fact all the modules are loading/working correctly on Node.JS and here I think @clmath found some issues that need to be fixed.