ardatan / meteor-webpack

https://medium.com/@ardatan/meteor-with-webpack-in-2018-faster-compilation-better-source-handling-benefit-from-bc5ccc5735ef
MIT License
123 stars 29 forks source link

Should I be able to use Meteor mainModule configuration with meteor-webpack? #34

Closed filipenevola closed 6 years ago

filipenevola commented 6 years ago

Hello, I tried to add Meteor mainModule configuration in the package.json to not use the imports folder but my main modules were not found on startup.

Should I be able to use Meteor mainModule with meteor-webpack?

You can see the problem here running meteor as usual. https://github.com/filipenevola/wantch/tree/meteor-main-module

If you want I can create a reproduction here in the React example but this code was copied from there.

The error that I got is below

=> Errors prevented startup:

   While building the application:
   error: Could not find mainModule for 'os' architecture:
   startup/server/main.js
   Check the "meteor" section of your package.json file?
   error: Could not find mainModule for 'web.browser' architecture:
   startup/client/main.js
   Check the "meteor" section of your package.json file?
   error: Could not find mainModule for 'web.browser.legacy' architecture:
   startup/client/main.js
   Check the "meteor" section of your package.json file?

=> Your application has errors. Waiting for file change.
nachocodoner commented 6 years ago

As far as I know the entry points now depend on the webpack configuration file. So you don't have to worry on the way Meteor handles that, just specify the entry points in Webpack, and don't use the import folder if you don't want. Meteor bundler is silented by the .meteorignore file, so even if you create other folders for your app code, any change won't make the meteor compiler to re-run.

A side note is that internally, meteor-webpack selects which configuration to use according to the meteor architecture being compiled. The client configuration is the one used for all web.* architectures, see here and here, where the webpack config from the client is selected to construct the webpack compiler. Any other architecture is considered as server and use server configuration. All meteor architectures are supported for generating the different bundles. So just focus on configure your webpack file.

ardatan commented 6 years ago

Thank you for explanation @Gywem So, I am closing this issue. Feel free to open a new one if you still have any problem.

filipenevola commented 6 years ago

@ardatan can I send a PR adding this information to the README? As I'm not able to run my Meteor projects without removing this section we need to warn the developers, right?

ardatan commented 6 years ago

Of course!