JorgenVatle/meteor-vite

Error: 'fetch' is not exported by meteor/fetch,

Closed this issue · 2 comments

Hi,

When I try to build my project without any mobile platforms, I have the following pb:

meteor build ../Invent
⚡️ Building packages to make them available to export analyzer...
⚡️ Packages built (21607ms)
⚡️ Building with Vite...
vite v3.2.7 building for production...`j...  /
✓ 564 modules transformed.
'fetch' is not exported by meteor/fetch, imported by imports/api/methods/products.js
file: /home/dev/project/imports/api/methods/products.js:4:9
2: import Products from "../collections/products";
3: import Items from "../collections/items";
4: import { fetch } from "meteor/fetch";
            ^
5: 
6: //import { ValidatedMethod } from 'meteor/mdg:validated-method';
Vite: worker process encountered an exception! Error: 'fetch' is not exported by meteor/fetch, imported by imports/api/methods/products.js

Hi,

When I try to build my project without any mobile platforms, I have the following pb:

meteor build ../Invent
⚡️ Building packages to make them available to export analyzer...
⚡️ Packages built (21607ms)
⚡️ Building with Vite...
vite v3.2.7 building for production...`j...  /
✓ 564 modules transformed.
'fetch' is not exported by meteor/fetch, imported by imports/api/methods/products.js
file: /home/dev/project/imports/api/methods/products.js:4:9
2: import Products from "../collections/products";
3: import Items from "../collections/items";
4: import { fetch } from "meteor/fetch";
            ^
5: 
6: //import { ValidatedMethod } from 'meteor/mdg:validated-method';
Vite: worker process encountered an exception! Error: 'fetch' is not exported by meteor/fetch, imported by imports/api/methods/products.js

I also encountered the same problem. But as far as I understand, this is not a plugin problem. This component is not available in the Meteor client part (at least in the latest updates).
I did it differently:
I moved this function to the server part of the meteor, and I simply access the function itself through a method.

Hi,

It works!

Thanks.