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

Support requirejs #17

Closed
totty90 opened this issue Nov 25, 2014 · 7 comments
Closed

Support requirejs #17

totty90 opened this issue Nov 25, 2014 · 7 comments

Comments

@totty90
Copy link

totty90 commented Nov 25, 2014

No description provided.

@tjmehta
Copy link
Owner

tjmehta commented Nov 25, 2014

Was waiting for this haha. So thought a little about this and I think I want to avoid shims in all the files that support all the different types of requires, because I think it would add a large percentage of useless lines to the repo (making each file that larger to app users).

So I'm think about a build step to duplicate logic into a /requirejs folder.. But that has the downside of doubling the initial download size for developers. I'll debate it out for a bit and come up with a solution this weekend?

Are there any goto strategies for using common-js modules with requirejs?

Ideas welcome. :)

@jrf0110
Copy link
Contributor

jrf0110 commented Nov 25, 2014

I would probably install requirejs as a dependency, then on postinstall do something like:

./node_modules/requirejs/bin/r.js *.js dist/requirejs/

That way the requirejs files are built upon installing 101. Then they can setup their require.config to just point to 101/dist/requirejs

@jfsiii
Copy link
Contributor

jfsiii commented Nov 25, 2014

As @jrf0110 points out, requirejs can consume and convert CommonJS modules, so you can keep authoring in CommonJS and let another tool post-process them to AMD.

IMO, requirejs would go in devDependencies as it's not required by all users. Also, the run script (postinstall, build-amd, etc) can just be something like r.js *.js dist/requirejs/ since npm-cli ensures the correct path for npm installed packages.

@tjmehta
Copy link
Owner

tjmehta commented Dec 15, 2014

If there is an already officially supported work-around for using CommonJS modules with require.js. How much of a help is it to bundle it into this module? Should I just add instructions in the Readme?

@totty90
Copy link
Author

totty90 commented Dec 15, 2014

A little bit offtopic but I just moved to webpack and I'm really happier than require.js. Everything is better than require.js. Setup takes some time, but is doable and worth!

@stoeffel
Copy link
Contributor

In underscore.string we use browserify to build a version of it, which can be consumed in requireJs or as a standalone script (with a global variable). Checkout https://github.com/epeli/underscore.string/blob/master/gulpfile.js#L22.
Maybe this approach would be a solution for 101 too.

@tjmehta
Copy link
Owner

tjmehta commented May 25, 2015

Closing this for now, bc original author is satisfied without this feature. Also, noone else has requested this.

@tjmehta tjmehta closed this as completed May 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants