Closed EdoElgx closed 6 months ago
Hmm. Not sure where the culprit for this is. If you have the chance, could you set up an example repository reproducing the issue so I have something to test against? 🙏
@JorgenVatle I added you to the repo. Let me know if it helps or if you need a brand new repo.
Thank you. I'll try to get through it today or later in the week. 🙌
Great!
Hey there! @EdoElgx So sorry for taking so long to get through to this. I didn't manage to catch that repo invitation in time. Any chance I could get another one? 🙏
Sure. In a minute.
Thank you! This one had me scratching my head for quite a while.
It seems like we're running into an edge-case with the Meteor JS minifier. When pulling down your project, I ran into the following error message upon building for production.
Related to https://github.com/meteor/meteor/issues/11644.
Moving the Vite entrypoint from imports/ui/main.jsx
to e.g. imports/entrypoint/vite.js
seems to have resolved the issue during production builds. I haven't been able to reproduce the error message mentioned in the issue. However. the app appears to load just fine after moving the entrypoint. 👍
Jorgen,
Thank you so much for your answer.
I tried the changes in your pull request, but I get this:
❯ node main.js
⚡ Starting Vite server...
/Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:218
throw error;
^
MeteorViteError:
⚡ Unable to locate Meteor-Vite workers! Make sure you've installed the 'meteor-vite' npm package.
L Install it by running the following command:
L $ npm i -D meteor-vite
at createWorkerFork (packages/jorgenvatle:vite-bundler/workers.ts:15:15)
at module (packages/jorgenvatle:vite-bundler/vite-server.ts:23:24)
at fileEvaluate (packages/modules-runtime.js:336:7)
at Module.require (packages/modules-runtime.js:238:14)
at require (packages/modules-runtime.js:258:21)
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/packages/jorgenvatle_vite-bundler.js:619:15
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/packages/jorgenvatle_vite-bundler.js:624:3
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/boot.js:385:38
at Array.forEach (<anonymous>)
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/boot.js:210:21
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/boot.js:439:7
at Function.run (/Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/profile.js:256:14)
at /Users/edoelk/Developer/ademsys/temp/vite-test/bundle/programs/server/boot.js:438:13
What meteor version are you using? And node version?
Thanks again.
Oh, is that from running the production bundle?
If so, make sure that NODE_ENV
isn't set to something like 'development'
or undefined
.
I'm running the server using the Meteor-tool's bundled Node version. $ meteor node main.js
Node v14.21.3 Meteor v2.12
Yes. That was from the production bundle.
Clearing NODE_ENV did the trick, but now when I run it all I get is a static page (client/main.html). More or less the same I had at the beginning, but without any console error message.
Cheers!
Oh, I don't believe that's not the case on my end.
Would you be okay if I added a workflow to your repo with some build steps to make sure we're seeing the same thing?
Sure, no problem.
BTW, I just executed:
meteor build ../temp/vite-test
It runs on a fresh Ubuntu 22 installation. That's the target, so that's perfect.
It doesn't work on local macOS 14.1 (Intel and M1). Any idea why?
Thanks!
Same production bundle, just works on Ubuntu but not Mac OS? 👀
Or do you mean when built on Mac OS, it doesn't work?
Sorry, I mean when built on macOS, the resulting bundle doesn't work, either locally or for Linux.
As I mentioned, I used a simple meteor build <path_to_build>
. May be I'm missing some important parameter for the build command (apart from the architecture)?
Anyway, I cloned the repo in another fresh Ubuntu VM and the build works perefectly.
My conclusion: Building in macOS doesn't work. We'll try in another few mac machines and let you know the results.
Oh, that's interesting.
If you put the following into your package.json, do you still have the same issue?
"meteorVite": {
"tempDir": ".build"
}
Jorgen,
I put that code in package.json and I get the same result: A static page, no console messages/errors:
I've tried in just one Intel machine. Tomorrow we'll test in other machines (M1) and let you know.
Thank you.
Update: On M1 mac, it works ok.
On Ubuntu, it always works.
I see. So I'm guessing just an environment thing then - thinking maybe Meteor or npm had cached an older version of the packages. But if it works, it works. 😄
If you run into the issue again, do let me know. 🙌
Hi All,
I have a Meteor/Sold.JS app which works wonderfully in my dev enviroment.
However, the deployed app just shows the inital page. The console shows React.JS related error messages!
This is my
vite.config.js
file:Does meteor-vite support Solid.JS? If so, how should I configure it?
Thank you.