Meteor module.runSetters(...) is not recognized by Meteor-Vite
Closed this issue ยท 38 comments
Hello,
i am getting
(STDERR) "Meteor module.runSetters(...) is not recognized by Meteor-Vite! Please open an issue to get this resolved!"
when launching meteor with this package. It tells me to open an issue. so here you go :)
Aha! Thank you for letting me know. I'll have that addressed shortly. This warning message should be safe to ignore. It's meant primarily to give a heads up in cases where an incompatible version of Meteor is in use. ๐
I see! ๐ค
Would you be able to provide me with an example project that replicates the issue, or possibly a list of Meteor packages in use by your project in case you don't have the time to set up a repo? ๐
could you please try with react-meteor-data? its one of many that does not work.
Looks like Meteor-Vite is unable to detect react-meteor-data
as a lazy-loaded package.
Adding import 'meteor/react-meteor-data';
to your Meteor entrypoint file should resolve the issue for you until I have a fix in place.
Edit
Looks like we still have some parser errors for react-meteor-data. I will follow up with you once a patch is in place.
Could you list the other packages that aren't working for you so I have something to test against?
now some new errors. do not know what i changed though, tried to just replicate error
Shipping a patch now which should resolve this issue for you. The package should also be automatically pulled into your main module following the update. ๐
tried with patch, HMR did spin up, but then again an error
I20230907-20:06:02.437(2)? 8:06:02 PM [vite] page reload imports/startup/both/i18n.js
I20230907-20:06:02.437(2)? 8:06:02 PM [vite] page reload imports/startup/client/index.jsx
I20230907-20:06:02.437(2)? 8:06:02 PM [vite] vite.config.ts changed, restarting server...
I20230907-20:06:02.662(2)? 8:06:02 PM [vite] server restarted.
W20230907-20:06:17.677(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:17.731(2)? (STDERR) 8:06:17 PM [vite] Internal server error: The "path" argument must be of type string. Received undefined
W20230907-20:06:17.732(2)? (STDERR) at new NodeError (internal/errors.js:322:7)
W20230907-20:06:17.732(2)? (STDERR) at validateString (internal/validators.js:124:11)
W20230907-20:06:17.732(2)? (STDERR) at Object.join (path.js:1148:7)
W20230907-20:06:17.732(2)? (STDERR) at Function.loadFileData (file:///Users/ouya/dev/webapp-webapp/node_modules/meteor-vite/dist/bin/worker/index.mjs:1308:26)
W20230907-20:06:17.732(2)? (STDERR) at Function.prepareContext (file:///Users/ouya/dev/webapp-webapp/node_modules/meteor-vite/dist/bin/worker/index.mjs:1273:23)
W20230907-20:06:17.732(2)? (STDERR) at Object.setupContext (file:///Users/ouya/dev/webapp-webapp/node_modules/meteor-vite/dist/bin/worker/index.mjs:1429:30)
W20230907-20:06:17.732(2)? (STDERR) at Context.load (file:///Users/ouya/dev/webapp-webapp/node_modules/meteor-vite/dist/bin/worker/index.mjs:1483:38)
W20230907-20:06:17.732(2)? (STDERR) at Object.load (file:///Users/ouya/dev/webapp-webapp/node_modules/vite/dist/node/chunks/dep-df561101.js:44254:64)
W20230907-20:06:17.732(2)? (STDERR) at runMicrotasks ()
W20230907-20:06:17.732(2)? (STDERR) at processTicksAndRejections (internal/process/task_queues.js:95:5)
W20230907-20:06:17.732(2)? (STDERR) at async loadAndTransform (file:///Users/ouya/dev/webapp-webapp/node_modules/vite/dist/node/chunks/dep-df561101.js:54878:24)
W20230907-20:06:17.732(2)? (STDERR) at async viteTransformMiddleware (file:///Users/ouya/dev/webapp-webapp/node_modules/vite/dist/node/chunks/dep-df561101.js:64345:32)
W20230907-20:06:17.816(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:17.817(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:17.817(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:17.936(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:17.936(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:18.183(2)? (STDERR) The "path" argument must be of type string. Received undefined
W20230907-20:06:18.184(2)? (STDERR) The "path" argument must be of type string. Received undefined
Oops, didn't mean to close it just yet. ๐
Let me know how it goes for you with the patch. ๐ค
(STDERR) The "path" argument must be of type string. Received undefined
I believe that error there is caused by a mismatch between the Atmosphere package jorgenvatle:vite-bundler
and the npm package meteor-vite
.
Can you double check for me which version of the vite-bundler you're on?
1.2.1 atmosphare package
used with "meteor-vite": "^1.3.2",
same error, i just did download it 2 weeks ago, so never used older version than 1.2.1
Aha. You will have to use jorgenvatle:vite-bundler@1.3.2
i rm the package and then tried to install 1.3.2
meteor add jorgenvatle:vite-bundler@1.3.2
=> Errors while adding packages:
While selecting package versions:
error: No version of jorgenvatle:vite-bundler satisfies all constraints: @1.3.2, @=1.2.1
Constraints on package "jorgenvatle:vite-bundler":
- jorgenvatle:vite-bundler@1.3.2 <- top level
- jorgenvatle:vite-bundler@=1.2.1 <- top level
What do you get if you run $ meteor list
?
meteor list
accounts-password 2.3.4 Password support for accounts
alanning:roles 3.5.1 Authorization package for Meteor
aldeed:collection2 3.5.0 Automatic validation of Meteor Mongo insert and update operations on the client and server
browser-policy 1.1.2 Configure security policies enforced by the browser
check 1.3.2 Check whether a value matches a pattern
ddp-server 2.6.2 Meteor's latency-compensated distributed data server
dev-error-overlay 0.1.2 Show build errors in client when using HMR
didericis:callpromise-mixin 0.0.1 A mixin for the mdg:validated-method package that adds a callPromise method
ecmascript 0.16.7 Compiler plugin that supports ES2015+ in all .js files
email 2.2.5 Send email messages
es5-shim 4.8.0 Shims and polyfills to improve ECMAScript 5 support
fortawesome:fontawesome 4.7.0 Font Awesome (official): 500+ scalable vector icons, customizable via CSS, Retina friendly
fourseven:scss 4.15.0 Style with attitude. Sass and SCSS support for Meteor.js.
johanbrook:publication-collector 1.1.0 Test a Meteor publication by collecting its output.
lacosta:method-hooks 1.5.4 Provide before and after hooks to methods created via mdg:validated-method
matb33:collection-hooks 1.2.2 Extends Mongo.Collection with before/after hooks for insert/update/remove/find/findOne
mdg:validated-method 1.3.0 A simple wrapper for Meteor.methods
meteor-base 1.5.1 Packages that every Meteor app needs
meteorhacks:aggregate 1.3.0 Proper MongoDB aggregations support for Meteor
meteortesting:mocha 2.1.0 Run Meteor package or app tests with Mocha
mizzao:user-status 1.0.1 User connection and idle state tracking for Meteor
mobile-experience 1.1.0 Packages for a great mobile user experience
mongo 1.16.7 Adaptor for using MongoDB and Minimongo over DDP
montiapm:agent 2.47.3 Performance Monitoring for Meteor
montiapm:debug 3.4.0 Full Stack Debugging Solution for Meteor
npdev:react-loadable 1.0.0 A React component for easy code splitting with Meteor's dynamic-import
ostrio:files 2.3.3 Upload files to a server or 3rd party storage: AWS:S3, GridFS, DropBox, and other
react-meteor-data 2.7.2 React hook for reactively tracking Meteor data
reactive-var 1.0.12 Reactive variable
reywood:publish-composite 1.7.3 Publish a set of related documents from multiple collections with a reactive join
seba:minifiers-autoprefixer 2.0.1 Standard minifiers used with Meteor apps by default + css autoprefixer.
service-configuration 1.3.1 Manage the configuration for third-party services
session 1.2.1 Session variable
shell-server 0.5.0 Server-side component of the meteor shell
command.
socket-stream-client 0.5.1 Provides the ClientStream abstraction used by ddp-client
standard-minifier-js 2.8.1 Standard javascript minifiers used with Meteor apps by default.
static-html 1.3.2 Define static page content in .html files
test:lazy 0.0.1+ summary
test:modules 0.0.1+ summary
test:stub-validation 0.0.1+ summary
test:ts-modules 0.0.1+ summary
tracker 1.3.2 Dependency tracker to allow reactive callbacks
tunifight:loggedin-mixin 0.1.0 A simple logged-in and roles check mixin to use with mdg:validated-method package
typescript 4.9.4 Compiler plugin that compiles TypeScript and ECMAScript in .ts and .tsx files
underscore 1.0.13 Collection of small helpers: _.map, _.each, ...
zodern:types 1.0.9 Type definitions for Meteor packages
Do you by any chance have a local vite-bundler
directory in your project packages directory?
Remove that and you're good to go. ๐
You should probably also remove the test packages there while you're at it. They'll only bloat your bundle with unnecessary test-specific exports. ๐ Just remember to also remove the references from your .meteor/packages
file.
ah react-is is part of meteor-vite (lock file), maybe just remove it? and it interferes with some react-is of my modules?
`This happens because Vite serves react-is โas-isโ - without transforming it anyhow and Vite relies on native modules in the browser. The โimportedโ file is this:
'use strict';
if ("development" === 'production') {
module.exports = require('./cjs/react-is.production.min.js');
} else {
module.exports = require('./cjs/react-is.development.js');
}
and as we can see this is just a CJS file.
According to the Vite docs this should be transformed during a โpre-bundleโ step: https://vitejs.dev/guide/features.html#npm-dependency-resolving-and-pre-bundling
From my PoV, it looks like an issue with Vite - Iโm not familiar with it enough to say whatโs exactly broken. The react-is is using the very same โstructureโ of distributed files etc as React itself so this should just be handled in the same way - and Iโm unsure why it isnโt in this case. Could you report this to the Vite team? Maybe they would have some pointers regarding this problem.`
Yeah, this doesn't look like an issue with Meteor Vite unfortunately. The react-is
dependency in the meteor-vite
lockfile is a dev dependency, so it shouldn't be pulled in by npm when you depend on meteor-vite
.
But it seems like you figured it out? ๐
I'll try to set up a React example app for further testing later this week.
Some quick Google searches lead me here: vitejs/vite#1984
Seeing as Meteor-Vite works similarly to running Vite in Middleware mode, this is likely the cause for your issue. I'm unsure if it would work in production, but you could try adding the suggested snippets to your Meteor main.html file to see if it makes any sort of difference?
If you're willing to set up an example repository reproducing the issue in the meantime, it would be a great help. ๐
tried adding it to main.html, no change
`<script type="module">
import RefreshRuntime from 'http://localhost:3000/@react-refresh';
RefreshRuntime.injectIntoGlobalHook(window);
window.$RefreshReg$ = () => {};
window.$RefreshSig$ = () => (type) => type;
window.__vite_plugin_react_preamble_installed__ = true;
</script>`
i will try to setup a demo repo coming days, if i do not find a quick solution. thanks for your support!
Alright, so seeing as the original topic for this issue should be resolved by now, let's move the discussion over to #29 as it relates to your latest issue there. ๐
Just a quick update on this, using the following snippet instead, explicitly importing from Vite instead of the Meteor web server seems to resolve the issue on my end.
By default the Vite server created by Meteor Vite is available at http://localhost:5173/
<script type="module">
import RefreshRuntime from "http://localhost:5173/@react-refresh" // Local Vite server created by Meteor-Vite.
RefreshRuntime.injectIntoGlobalHook(window)
window.$RefreshReg$ = () => {}
window.$RefreshSig$ = () => (type) => type
window.__vite_plugin_react_preamble_installed__ = true
</script>
Hmm.. Doesn't seem related to Meteor-Vite. Though, it suspiciously looks like a cjs/esm incompatibility. ๐ค
Oh, I could totally be wrong here though. ๐