Use Webpack with Meteor simply by adding packages (meteor-webpack 1.0 is out!)

I’m signed up and waiting with bated breath :smile:

1 Like

Wow, I feel so blessed to have so much enthousiastic people in the Meteor community!

I was actually half inactive. I was REALLY busy with a lot of projects (and still are) but I’m trying my best to give a better support.

For the migration path, it will be very minimalist if you keep your webpack.config.js files. Your package.json file will be automatically migrated. The only missing piece will be to set the correct entry files in it. It shouldn’t take you a lot of time. If anything goes wrong let me know :slightly_smiling:

good job!..

2 Likes

I added the support of .babelrc file. If you have a .babelrc file in your root, you can add new presets/plugins. Example:

{
  "plugins": ["jsx-control-statements"]
}
1 Like

@benoitt, is there any reason that you have to depend on react-runtime and not purely on NPM’s react and react-dom?

You don’t have to depend on react-runtime. However if you do, webpack will make sure you use the Meteor version instead of NPM.

If you don’t use react-runtime, you can’t use ReactMeteorData, correct me if I’m wrong.

1 Like

Is it compatible with the structure recommended by mantra?

Yes it is! I am currently looking into adding an official mantra kickstarter. webpack:webpack don’t care very much about your file structure or any tech used within Meteor.

For now you can look at this repo but ATM it is still on the old meteor-webpack version.

Because I tried to add it to a https://github.com/mantrajs/mantra-sample-blog-app project and it didn’t seem to work - it throw an error that Npm is not defined.

But maybe I should wait for the first email of the 7 day series :slightly_smiling:

Okay thanks. I wasn’t interested in using ReactMeteorData, that’s why I asked.

I’m looking with the Mantra community how we will do it but hopefully it will be integrated soon :slight_smile:

3 Likes

Right now I’m trying this out with a Mantra app… I hope everything works! :smile:

1 Like

Just making this as a placeholder to go back once the Mantra thing has been sorted out. Would be great to be able to do code splitting with the application i’m building.

If I’m not mistaken, it appears hot reload doesn’t work with react from npm (because it adds react-runtime from meteor automatically)?

Marks-MacBook-Air:markshust$ meteor add webpack:react
                                                                                   
Changes to your project's package version selections:
                                              
jsx                  added, version 0.2.4     
react-meteor-data    added, version 0.2.5
react-runtime        added, version 0.14.4
react-runtime-dev    added, version 0.14.4
react-runtime-prod   added, version 0.14.4
webpack:core-config  added, version 1.0.0
webpack:react        added, version 1.1.0

You’re right. I’m pretty sure the dependency is not required, I’m looking if I can remove it safetly.

1 Like

Thanks for pointing this out to me I haven’t tested with HTTPS (oops).

But you should be able to subscribe. Is it still crashing?

When will the course be available? In the meantime, what would you recommend as the best intro? Fairly new to Meteor and haven’t used webpack before…

If you’re completely new to Meteor, I suggest that you first learn the basis with Blaze. You can go through the official tutorial. Then you can look at the kickstart projects with webpack and Meteor. Yuo can also try to start a new project by yourself by using the webpack:webpack documentation.

You can also look at Webpack tutorials but 90% of the stuff will not be useful because you don’t need to worry about the config.

The 7 day course should start by next week. :smile:

1 Like

Thank you for fantastic work, @benoitt! We are also using react from NPM (actually as much from NPM as possible), so removing dependency on Atmosphere’s version of react would be a great plus for us.

Webpack integration will hopefully allow to use NPM packages that load CSS modules (like react-toolbox) in Meteor projects. Looking forward to testing this out!

Thanks again,

Telman

Possibly the solution might be to publish a NPM version of this without the dependency. That way those on 1.3 using NPM React can continue forward and you avoid issues with those using the atmosphere react.

1 Like