Akryum / meteor-vite

MIT License
33 stars 16 forks source link

METEOR_LOCAL_DIR #46

Open mattsouth opened 6 months ago

mattsouth commented 6 months ago

For testing purposes, it can be useful to run meteor locally, using a different local cache location. This article: https://blog.meteor.com/testing-a-meteor-app-with-cypress-bfb3d3c6ed6f suggests doing this with the METEOR_LOCAL_DIR environment variable that was introduced in meteor v1.3.3. Can this be supported by meteor-vite? If I create a skeleton vue project in meteor 2.15 and run meteor locally with this ENV variable the app fails with the following output:

me@mymachine:~/Software/meteor-vue-2.15$ METEOR_LOCAL_DIR=.meteor/test meteor
[[[[[ ~/Software/meteor-vue-2.15 ]]]]]        

=> Started proxy.                             
=> Started HMR server.                        
=> Started MongoDB.                           
I20240214-11:21:14.127(0)? ⚡   Starting Vite server...
W20240214-11:21:14.131(0)? (STDERR) ⚡  You are using an out of date version of `meteor-vite`.
W20240214-11:21:14.131(0)? (STDERR)    Please update it: $ meteor npm i meteor-vite@1.8.0
=> Started your app.

=> App running at: http://localhost:3000/
I20240214-11:21:14.377(0)?   ➜  Local:   http://localhost:5173/
I20240214-11:21:14.377(0)?   ➜  Network: use --host to expose
I20240214-11:21:14.383(0)? ⚡   Meteor-Vite ready for connections!
I20240214-11:21:14.385(0)? ⚡   Meteor-Vite ready for connections!
W20240214-11:21:15.972(0)? (STDERR) (node:1361692) UnhandledPromiseRejectionWarning: Error: Unable to read file content: ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/meteor.js'
W20240214-11:21:15.972(0)? (STDERR)     at file:///home/matt/Software/meteor-vue-2.15/node_modules/meteor-vite/dist/bin/worker.mjs:1349:13
W20240214-11:21:15.972(0)? (STDERR) (Use `node --trace-warnings ...` to show where the warning was created)
W20240214-11:21:15.973(0)? (STDERR) (node:1361692) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
W20240214-11:21:15.973(0)? (STDERR) (node:1361692) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
W20240214-11:21:15.995(0)? (STDERR) 
W20240214-11:21:15.995(0)? (STDERR)  ERROR  Unable to read file content: ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/meteor.js'
W20240214-11:21:15.996(0)? (STDERR) undefined
W20240214-11:21:15.996(0)? (STDERR) 
W20240214-11:21:15.996(0)? (STDERR) --[Error Stack]----------------------------------------------------------------------
mattsouth commented 6 months ago

On further testing I can see that the reproduction I created above uses a fork of this project: JorgenVatle/meteor-vite (I hadnt spotted the switch of the skeleton to use it) and I can also see that if you run your project using meteor before running it with METEOR_LOCAL_DIR=.meteor/test meteor then this project works without errors. But if you havent previously run the app (and thus built it) you see a similar set of errors:

me@mymachine:~/Software/meteor-vue-2.12.0$ METEOR_LOCAL_DIR=.meteor/test meteor
[[[[[ ~/Software/meteor-vue-2.12.0 ]]]]]      

=> Started proxy.                             
=> Started HMR server.                        
=> Meteor 2.15 is available. Check the changelog
https://docs.meteor.com/changelog.html and update this project with 'meteor
update'.
=> Started MongoDB.                           
=> Started your app.                          

=> App running at: http://localhost:3000/
W20240215-11:27:03.516(0)? (STDERR) ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/meteor.js'
W20240215-11:27:03.549(0)? (STDERR) ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/tracker.js'
W20240215-11:27:03.550(0)? (STDERR) ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/meteor.js'
W20240215-11:27:03.559(0)? (STDERR) 11:27:03 [vite] Internal server error: ENOENT: no such file or directory, open '.meteor/local/build/programs/web.browser/packages/meteor.js'
W20240215-11:27:03.559(0)? (STDERR)   
JorgenVatle commented 6 months ago

Oops. These changes haven't been merged in with this repo just yet. 😅 Keeping it open for now.