-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meteor/alanning:roles package creates Undefined export exception #246
Comments
Interesting. I'll write up some test cases for this over next week and get back to you once I have more details. 👍 |
FYI Looking at the 3.1 release notes I can see that the roles package has been moved to core in this version, see https://forums.meteor.com/t/meteor-js-v3-1-is-out/62607 |
This issue still persists in meteor v3.1, using the core roles module. But I think my comment about not being to run this app in production is wrong - in my testing this morning I see I can run the app with |
Just resolved some issues with the Meteor package parser which likely is related to the issue you were seeing there. The latest alpha build should have a fix for the issue available. meteor remove jorgenvatle:vite-bundler
meteor add jorgenvatle:[email protected]
npm i meteor-vite@alpha
# The alpha build only supports Vite v6.
# If you're seeing peer dependency complaints from npm, run the following to upgrade Vite and Vue.
npm i vite@latest @vitejs/plugin-vue@latest Let me know how it goes. 🤞 |
I was able to install and run the latest build but it didnt resolve the issue. In the browser console I still see:
These packages are defined here: https://github.com/meteor/meteor/blob/2e032970bfafebc33ccc79f14499e2a329770924/packages/roles/roles_common_async.js#L29 |
FYI - current dependencies ....
|
I initially thought there was an issue with the package parser, it seems like Meteor-Vite was built to detect and abort builds when exports are missing as that was quite a big concern in versions prior to the fork. The module resolver should be fairly robust now, so you should probably be safe to just keep // vite.config.ts
defineConfig({
plugins: [
meteor({
clientEntry: '...',
stubValidation: {
warnOnly: true
}
})
]
}) We're probably going to phase out the feature entirely down the line as Vite/Rollup already do a decent job of detecting when something isn't right. The warning messages might still show up in production though - I'll try to address that with the next release. Just to clarify though, your production builds are passing right? |
Thanks for the write up. Is it worth raising an issue with the meteor team for the undefined exports? My production build is broken with the new jorgenvatle:vite package and vite 6. The app appears to build fine but then shows a blank page. |
Alright, thanks for the clarification. Same issue with previous versions? |
Yep, that's what I remember seeing when I first wrote this issue (with meteor 3.0.4) but for a while in the middle the production builds were working. |
I see, would you be able to create a repository reproducing the issue by chance? I don't believe the issue is related to the Are there any other warning messages that appear in the browser console? |
I cant yet reliably recreate this issue but intermittently in development I see this on startup:
which also yields a blank screen. Could this be related? Also note the out of date meteor-vite warning, (Im using 1.12.0). I'll keep trying. |
Oh, There is a hotfix for this that I just noticed has been pending release for a little while now. I'll see if I finish it up over the next couple days. In the meantime, I think the above command should resolve the issue for you. |
The fix should be live now with #228 meteor npm i meteor-vite@latest
meteor add jorgenvatle:[email protected] |
roger that, I find a good config is ... meteor:
which doesnt show the meteor-vite version message. I'll let you know if I see a white screen again. |
I got this issue as well by using the steps given for Meteor 3. So, after downgrading the vite version to v4 and and using the vite config accordingly to the vite.config.ts plugins: [
meteor({
clientEntry: 'imports/startup/client/index.ts',
}),
vue(),
vuetify({ autoImport: true }),
],
optimizeDeps: {
exclude: [
'vue-meteor-tracker',
],
}, package.json
server/main.ts
client/main.ts_
My repo example is this one . I intend to update vite to v6 to give you an example in how reproduce the Roles issue. So, in short, I used the steps given for Meteor 2 even with my app in Meteor 3 and Vue 3. |
@diavrank Add the following to your MeteorVIte config. You can also set validation to "warnOnly" if you don't want builds to fail because of a missing export. Validation is strict by default intentionally throwing to prevent unwanted surprises in production in case a lazy-loaded package never gets included in your Meteor client bundle. For plugins: [
meteor({
clientEntry: 'imports/startup/client/index.ts',
+ stubValidation: {
+ ignorePackages: ['meteor/roles'],
+ }
}),
]
|
Nice, will try later and let you know if the issue get fixed. Thanks for the tip @JorgenVatle . |
@JorgenVatle it worked with that config. Here is my PR with the changes in case it helps someone else :) |
Tested in production as well with disney meteor-base docker image :) |
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:
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:
The text was updated successfully, but these errors were encountered: