Akryum / meteor-vite

MIT License
33 stars 16 forks source link

Meteor packages with `lazy:true` not working #2

Closed afrokick closed 1 year ago

afrokick commented 1 year ago

Simple lazy package

package.js:

Package.describe({
  name: 'test:lazy',
  version: '0.0.1',
  summary: 'summary',
  git: 'https://github.com/Akryum/meteor-vite',
  documentation: 'README.md',
})

Package.onUse(function(api) {
  api.use('ecmascript')
  api.mainModule('index.js', ['client', 'server'], { lazy: true });
})

index.js:

export const A = 1;

add the package to your vite project:

meteor add test:lazy

Use it somewhere in your project:

main.ts:

import { A } from 'meteor/test:lazy'

Result

Browser error:

Uncaught SyntaxError: The requested module '/@id/__x00__meteor/test:lazy' does not provide an export named 'A'

afrokick commented 1 year ago

Please, check module.exportDefault and module.link in reify readme @Akryum https://github.com/benjamn/reify/blob/c9657a9fcb735b870c6c7ee6e95b1403517189e8/README.md#exports-that-are-really-imports

Akryum commented 1 year ago

Please, check module.exportDefault and module.link in reify readme @Akryum benjamn/reify@c9657a9/README.md#exports-that-are-really-imports

Fixed in https://github.com/Akryum/meteor-vite/commit/a592eacca3851ad3e05c2a6e940085f2c9d2c82a (v0.1.5)

gunnartorfis commented 1 year ago

I'm still seeing the following error: Uncaught SyntaxError: The requested module '/@id/__x00__meteor/react-meteor-data' does not provide an export named 'useTracker'

Environment:

red-meadow commented 1 year ago

I think, this issue #21 is the source of "The requested module..." error. If you fork react-meteor-data and add the line export const A = 'A', it works. image