New package "rocket:module" to provide CJS/AMD/ES6 Modules for Meteor packages with shared NPM dependencies

I’m also interested in how ES2015 modules will be integrated into Meteor core. Maybe @benjamn can share some plans if they already exist. :smile:

1 Like

Yes, please, if there are already plans it would be great to know what they are @benjamn. :smiley: I’ve been curious for a couple months now. It’d be nice to know in order to save time and efforts. I could work on other things or collaborate on the official solution if making rocket:module isn’t necessary. Please advise!

@jedwards Can you explain why you need the Webpack PrefetchPlugin? Never used it before.

Unfortunately I can’t yet, if I figure out why it solved that duplicate
React module problem I’ll let you know.

@jedwards Interesting. Coincidentally, one of the first things I’m planning to do after releasing rocket:module is importing React, react-famous, and Famous Engine into my project. Let’s see how it works…

Alright guys, the first usable version of rocket:module (v0.2.0) is out on GitHub, along with some basic usage instructions which I’ll be adding to the README soon. Note, although it’s usable, it’s probably not ideal for production (and perhaps not even for development) yet. v1.0.0 will be the first full-featured stable release. Also note that rocket:module uses the new Plugin.registerCompiler API, which isn’t released yet (it’s coming out very soon), so rocket:module can’t be published to Atmosphere yet. Lastly, the devel branch of Meteor is required, so for now check out the devel branch then export PATH=/path/to/meteor/repo:$PATH.

Does that work with the preview version ?

@vjau I’m not quite sure what you’re asking. Does ____ work with the preview version of ____?

@vjau Oh, the preview version of Meteor. :smile: Yes, it should!

So, instead of having to clone meteor like I described, just run

meteor --release PLUGINS-PREVIEW@1
1 Like

@gabrielhpugliese I like your solution to using webpack locally to build from a hidden folder and place the bundle in the app. That’s what I was originally doing too, but the downside of that is that if another package in your project wants to use the react dependency to, for example, provide more React components, then you’ll have two versions of react in your app: the one you’re compiling, and the one that the package has. That right there is what got me thinking of a solution and eventually the idea for rocket:module. By the way, it’s usable now! Docs coming soon.

2 Likes

I was thinking about that today.
Really going to test your package!

@trusktr, is it possible to post 1 slightly more complete example or sample (gist) to copy/paste just to make it easy to test quickly? E.g. one basic example without using a package, add React or something simple.

@rolf Sure! I’ll have a sample repo up by this weekend as well as some initial docs in the README. I’ve been testing it for the past few days on a real project to get ready for it. :smile:

Hey joe, I’m curious, will rocket:module work for importing from other files in the project by relative path, or only NPM modules?

It should be pretty easy in that case to write a script that exports the same React that the meteor package uses, and in the webpack config alias react$ and react/addons$ to that script.

I’m trying to run the module-example-app but I’m getting errors. What should I do?:

$meteor

=> Started proxy.
=> Started MongoDB.
=> Errors prevented startup:

While checking for rocket:webpack@1.9.10_1:
error: No compatible binary build found for this package. Contact the package author and ask them to publish it for your platform.

=> Your application has errors. Waiting for file change.

@jedwards Importing other files, definitely.

@gabrielhpugliese Which OS are you in? This hasn’t been tested in Windows yet, if that’s the case, and I haven’t published for Windows yet. The example app isn’t ready yet (hence the “(Will be)” in the title). I’m aiming to have the app working and docs in rocket:module's README by this weekend. Hang tight. :smiley:

I’m gonna give a lightning talk on rocket:module, tomorrow at DevShop time willing. I might just have the demo app ready before tomorrow night. :smile:

I myself am just now using rocket:module in a real app for the first time. Here’s a screenshot:

I’ll post usage instructions real soon!

1 Like