-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
jspm bundle to AMD/CJS #75
Comments
It might be - we'd lose circular reference support. What sort of use cases are you thinking of? |
Another thing I've been meaning to consider as well is self-contained bundles that run themselves. |
We currently distribute Scribe as a bundled file containing all the necessary AMD modules (created using the r.js optimizer). AMD consumers of our library are therefore catered for, and we have a rather hacky workflow for Browserify (CJS) users, whereby they can import Scribe by running We are now thinking of moving Scribe to using jspm because we need to depend on libraries which do not share our module format. E.g. we want to depend on We're happy to move the Scribe source files to ES6, but we will still need to distribute the library as AMD and CJS because that's what the majority of our users are using. AFAIK, |
This is quite important for portability I agree. We are working hard on this use case, I'm hoping to have something in the next month. |
Great! Is there anywhere I can track the discussion/implementation? |
Sure, I'm trying to see if we can collaborate on something here - caridy/es6-micro-loader#2. |
I actually made some unexpected progress on these self-contained bundles. I expect we can have an initial unstable version of this in the release coming next week. |
Could it emit as UMD (universal module definition)? -> https://github.com/umdjs/umd |
UMD is not suitable for a combined output since all module formats have circular references behaving differently. This will thus introduce edge case issues. Feel free to do your own transpilation process if you know this will work for your cases though, but we're solving the problem a bit more generally here. |
I don't think we will support bundling into formats other than System.register due to the nature of the module format interactions. I may be wrong though so feel free to continue the discussion. |
BTW, one can always ask upstream project to add hooks to include in other ways. They could make code check for existence of various loaders and use that. |
@guybedford is it still actual information that we cant bundle es6 code to amd using jspm? I have same issue as @OliverJAsh, want to "export" it as amd to use in an existing requirejs app. |
@djindjic jspm doesn't provide this functionality but other tools like Babel can do this for you (http://babeljs.io/docs/usage/modules/) |
thanks @guybedford. It seems there is no way to use both jspm and babel's features. For example, I really love jspm's format agnostic imports, and workflow with systemjs plugins, but now I am working on angular 1/.x directives library and want to export it as an amd module or global object bundle and allow users to include it in their existing apps without package managers while I still want to use jspm install for third party libs in my directives library. |
There main workflow for this use case currently it to compile ES6 to CJS if Alternatively if you're happy to build in your dependencies use an SFX You can write SFX bundles that have global adapters that check for the On Tue, Mar 24, 2015 at 8:54 AM Aleksandar Djindjic <
|
SFX bundle sounds like it might help me. Until now I have use it just like this: jspm bundle-sfx app/main app.js Are global adapters custom code which I need to write into compiled sfx bundle after jspm-cli command? |
Yes, you would basically write: adapters/jquery.js And then add a map: System.config({ On Tue, Mar 24, 2015 at 1:35 PM Aleksandar Djindjic <
|
once again, WOW + THANKS! looks so logical when somebody show you how 😄. that's fine, and by my opinion it is cleaner then npm-CJS in case of browser usage. You made my day because I was totally sure that I will have to use bower and es5 again (and sedatives 💊) 😃 |
* jspm link workflows * finish up build
* jspm link workflows * finish up build
* jspm link workflows * finish up build
* jspm link workflows * finish up build
* jspm link workflows * finish up build
Is this possible?
The text was updated successfully, but these errors were encountered: