Open lucidprogrammer opened 8 years ago
@lucidprogrammer Did you manage to fix these?
@lucidprogrammer Sorry for the delay on this one. I missed it somehow.
Meteor build should be used only for the server. For the client, use webpack instead.
Does that solve your question?
@luisherranz The __meteor_runtime_config
error is coming from the client (webpack) on this line because it hasn't been defined yet
This also happens in the es2015-meteor1.3 example
I think @lucidprogrammer wanted to have a single meteor app including the client bundle for which my approach would be:
cd dev-app/client
webpack // this outputs the bundle.js file to the build/ directory
cd path/for/production
meteor create production-app
// copy the client bundle into a client/ folder
// copy the server files into a server/ folder
meteor build
I think @lucidprogrammer wanted to have a single meteor app including the client bundle.
If you want to be able to use meteor build for the client, maybe this project is a better fit: https://github.com/thereactivestack/meteor-webpack/tree/master/packages/webpack/
@luisherranz The __meteor_runtime_config error is coming from the client (webpack) on this line because it hasn't been defined yet
I see. It looks like it doesn't like that global declaration. Could you please check if this works?
window.__meteor_runtime_config__ = config;
This was long ago. This is what i ended with
@luisherranz That fixes it, yes
Refer to this, it fixes. This the one i used in that sample https://github.com/lucidprogrammer/meteor-imports-webpack-plugin
@luisherranz That fixes it, yes
Great! I'm leaving right now but I will upload a fix on Monday.
@lucidprogrammer that's so cool. I am glad this is useful for somebody! (as I am not using it myself).
Would you consider making a PR with your modifications so anybody can benefit?
Yes will do
Will do in the weekend. Tks
I have fixed the __meteor_runtime_config__
problem and published a new version to npm.
Interesting project @luisherranz
If i understand correctly, I run the meteor (for server code) and webpack for client code during development. How do I do the meteor build for production with this approach, any inputs?
I gave a try with the example in es2015-meteor1.3-react
After the following change, it does the build without errors. ` var MeteorImportsPlugin = require('meteor-imports-webpack-plugin');
module.exports = { entry: './client/entry.jsx', output: { path: './build', filename: 'bundle.js' }, module: { loaders: [{ test: /.jsx?$/, loader: 'babel', query: { presets:['es2015', 'react'] } }] }, plugins: [ new MeteorImportsPlugin({ ROOT_URL: 'http://localhost:3000/', DDP_DEFAULT_CONNECTION_URL: 'http://localhost:3000/', PUBLIC_SETTINGS: {}, meteorFolder: 'server', meteorEnv: {}, exclude: ['ecmascript'] }) ] };
` However, no joy visiting localhost:8080(http://localhost:8080/bundle.js does show the js file ) bundle.js:7417 Uncaught ReferenceError: meteor_runtime_config is not defined
FYI ` in bundle.js /* 77 / /**/ function(module, exports) {
/***/ },
and the offending part is var config = webpack_require(77);
` (Anyway if you define with a var to meteor_runtime_config = config; this will go away. However, additional issues like bundle.js:32275 Uncaught TypeError: Cannot read property '_' of undefined (root =this, so not defined etc. ) This is a promising project and could be really useful to many. Could you check this example with 1.3-react with the latest METEOR@1.3.2.4 and see if this package be updated with the necessary fixes. It can be great and well appreciated. Tks