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

import with broken by vite plugin #1013

Closed
1 task
Idrinth opened this issue Apr 4, 2024 · 15 comments
Closed
1 task

import with broken by vite plugin #1013

Idrinth opened this issue Apr 4, 2024 · 15 comments

Comments

@Idrinth
Copy link

Idrinth commented Apr 4, 2024

What version of million are you using?

3.0.6

Are you using an SSR adapter? If so, which one?

none

What package manager are you using?

npm

What operating system are you using?

Windows+Linux

What browser are you using?

Chromium, Firefox

Describe the Bug

import pkg from '../../../../package.json' with {
  type: 'json'
};

is compiled wrongly, breaking it, because the { and } get removed. This errors out in the following build step.

What's the expected result?

The plugin does not remove required curly braces

Link to Minimal Reproducible Example

https://stackblitz.com/edit/vitejs-vite-azcm9h

Participation

  • I am willing to submit a pull request for this issue.
Copy link

github-actions bot commented Apr 4, 2024

Thanks for opening this issue! A maintainer will review it soon.

@tobySolutions
Copy link
Contributor

Hello there @Idrinth, do you think you can provide a reproduction that I can have a look at and then present to the team if need be. You shouldn't be getting the above error at all.

@Idrinth
Copy link
Author

Idrinth commented Apr 4, 2024

terribly sorry if the example was too big. will put some time aside to build a smaller one tomorroe

@Idrinth
Copy link
Author

Idrinth commented Apr 5, 2024

Hello there @Idrinth, do you think you can provide a reproduction that I can have a look at and then present to the team if need be. You shouldn't be getting the above error at all.

https://stackblitz.com/edit/vitejs-vite-azcm9h

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.

@github-actions github-actions bot added the Stale label Apr 21, 2024
@Idrinth
Copy link
Author

Idrinth commented Apr 21, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.

That shouldn't be the case, issue is still unsolved to my knowledge.

@github-actions github-actions bot removed the Stale label Apr 22, 2024
@tobySolutions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days.

That shouldn't be the case, issue is still unsolved to my knowledge.

Hmm, thank you very much for this. Really appreciate this. Let me share this with the team. Sorry for the auto-labelling bot.

@tobySolutions
Copy link
Contributor

Taking a look at your reproduction now.

@tobySolutions
Copy link
Contributor

Ok, I fixed it @Idrinth; the issue isn't a Million issue at all. It's an issue with babel and vite I think. So, I did a bit of research around and found a fix:

https://stackblitz.com/edit/vitejs-vite-gm2ltv?file=vite.config.ts

@Idrinth
Copy link
Author

Idrinth commented Apr 25, 2024

Ok, I fixed it @Idrinth; the issue isn't a Million issue at all. It's an issue with babel and vite I think. So, I did a bit of research around and found a fix:

https://stackblitz.com/edit/vitejs-vite-gm2ltv?file=vite.config.ts

That is using the deprecated assert instead of with for the import. Can't replicate it working once I switch back to with.

@tobySolutions
Copy link
Contributor

Ok, I fixed it @Idrinth; the issue isn't a Million issue at all. It's an issue with babel and vite I think. So, I did a bit of research around and found a fix:

https://stackblitz.com/edit/vitejs-vite-gm2ltv?file=vite.config.ts

That is using the deprecated assert instead of with for the import. Can't replicate it working once I switch back to with.

Oh yes, you are correct. However this issue has nothing to do with Million.

It still says the same thing when you remove Million from your codebase.

@Idrinth
Copy link
Author

Idrinth commented Apr 25, 2024

Ok, I fixed it @Idrinth; the issue isn't a Million issue at all. It's an issue with babel and vite I think. So, I did a bit of research around and found a fix:
https://stackblitz.com/edit/vitejs-vite-gm2ltv?file=vite.config.ts

That is using the deprecated assert instead of with for the import. Can't replicate it working once I switch back to with.

Oh yes, you are correct. However this issue has nothing to do with Million.

It still says the same thing when you remove Million from your codebase.

In that case my small example is insufficient, will try to replicate the issue in something slightly bigger. My main project works without million and only breaks once adding it :(

@Idrinth
Copy link
Author

Idrinth commented May 1, 2024

more digging and it looks like there is no way on million's side to fix this. Will have to do some code replacements to byopass the vite issue I guess.

@Idrinth Idrinth closed this as completed May 1, 2024
@tobySolutions
Copy link
Contributor

Yes @Idrinth, thank you very much 🙌

@Idrinth
Copy link
Author

Idrinth commented May 3, 2024

Yes @Idrinth, thank you very much 🙌

was easier than expected, actually just needed to switch to the babel plugin instead - that worked out fine.

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

2 participants