Skip to content
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

Cannot import from 'meteor/accounts-base' - Uncaught SyntaxError: Unexpected token 'default' #8

Closed
Tracked by #30 ...
red-meadow opened this issue Sep 18, 2022 · 5 comments

Comments

@red-meadow
Copy link
Contributor

@Akryum , thank you very much for quickly fixing previous issues. Unfortunately, I've found some more. Apart from that, everything works great. I've managed to run a huge Svelte + TailwindCSS project.

The issue is described in the title.

image

image

@ThaumRystra
Copy link

I'm having the same issue.

It looks like module re-exports are not catching all default exports and letting default through as an exported key instead: https://github.com/Akryum/meteor-vite/blob/main/packages/vite-bundler/worker-dev.mjs#L108

And probably again here:
https://github.com/Akryum/meteor-vite/blob/main/packages/vite-bundler/build.js#L160

@diavrank
Copy link

diavrank commented Nov 25, 2022

@red-meadow @ThaumRystra you just need to remove the Account imports in the client side to solve that error. Accounts is a global variable, so, your app will work anyway, even without the import statements.

References:
https://forums.meteor.com/t/status-of-vue-3-meteor/57915/47?u=diavrank95

@mikkelking
Copy link

Meteor appears to be happy with statements like

export default = m2.default

But I am seeing in other place (eg Storybook) that it wants the declaration and default export to be done separately

So in this case

export default m2.default will work

And otherwise if you are doing

export default x = () => 'Something'

You can just do it like this:

const x = () => 'Something'
export default x

Or if you want, it can be done without a local variable in a one-liner

export default () => 'Something'

@diavrank
Copy link

I have a working example with Vite 4 and Meteor 2.10.0 here diavrank/theory-swe#5

@gunnartorfis
Copy link

@red-meadow @ThaumRystra you just need to remove the Account imports in the client side to solve that error. Accounts is a global variable, so, your app will work anyway, even without the import statements.

References: https://forums.meteor.com/t/status-of-vue-3-meteor/57915/47?u=diavrank95

Confirmed this fixed the issue for me but I also had to remove it from my server part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants