JorgenVatle / meteor-vite

⚡ Replace Meteor's bundler with Vite for blazing fast build-times
MIT License
32 stars 10 forks source link

meteor/alanning:roles package creates Undefined export exception #246

Open mattsouth opened 3 days ago

mattsouth commented 3 days ago

The meteor/alanning:roles package is a meteor community package and if I include it in a vanilla vue meteor 3.0.4 project then I see problems in the client build during validation that say:

UndefinedExportException: Could not import Meteor package into the client: export 'RolesCollection' is undefined UndefinedExportException: Could not import Meteor package into the client: export 'RoleAssignmentCollection' is undefined

And a suggestion to raise an issue here (thankyou - that's a very clear steer). In development the issues can be fixed by disabling validation but this will stop a production build being created. The issue can be replicated by adding the package and then updating the imports/ui/Home.vue component to be:

<script setup>
import Hello from './Hello.vue'
import Info from './Info.vue'
import { Meteor } from 'meteor/meteor'
import { Roles } from 'meteor/alanning:roles'
import { computed } from 'vue'

const isAdmin = computed(() => Meteor.user() ? Roles.userIsInRole(Meteor.user()._id, ['admin']) : false)
</script>

<template>
  <h1 class="text-3xl font-bold my-6">Welcome to Meteor!{{ isAdmin ? ' (Admin)' : ''}}</h1>
  <Hello />
  <Info />
</template>
JorgenVatle commented 1 day ago

Interesting. I'll write up some test cases for this over next week and get back to you once I have more details. 👍