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

failed to load module for ssr: /node_modules/svelte-flagpack/src/Flag.svelte #7

Open
AqueleHaru opened this issue Nov 15, 2021 · 15 comments
Labels
bug Something isn't working
Milestone

Comments

@AqueleHaru
Copy link

failed to load module for ssr: /node_modules/svelte-flagpack/src/Flag.svelte

cant use the package :(

@zoeyfrisart
Copy link
Member

@haruzinh0 Thank you for letting us know that you are experiencing issues with Svelte Flagpack right now.

Could you tell us some more information about the environment that you experience this issue in? This will help us reproduce the issue and solve it sooner.

We have added this issue to our backlog and will let you know when we have resolved the issue.

@zoeyfrisart zoeyfrisart added the bug Something isn't working label Nov 15, 2021
@zoeyfrisart zoeyfrisart added this to the 0.1.1 milestone Nov 15, 2021
@AqueleHaru
Copy link
Author

Sup! i just followed the README. step by step. when i import Flag and try to use any flag the error happens (im using sveltekit)

@AqueleHaru
Copy link
Author

image
seems like src folder was not downloading in package idk

@AqueleHaru
Copy link
Author

i literally just followed the steps to install then i get the error.
image

@AqueleHaru
Copy link
Author

any update?

@scippio
Copy link

scippio commented Dec 7, 2021

Same here... 😞

zoeyfrisart added a commit that referenced this issue Dec 7, 2021
The current implementation of Svelte is not working, this is because we don't include Flag.svelte in the output file.

This leads to an issue as the file is not defined, however the new attempt also doesn't work for the following reasons:
- Will require users to install SASS into their codebase, which isn't desirable
- Is seemingly unable to resolve the files that are included in the dist folder.
- This code is uncompiled, which may or may not be desirable

Relates to: #7
@zoeyfrisart
Copy link
Member

Apologies for the late response, at the moment we have no further update. We have taken a look at the issue and have identified the cause of the problem. But at this moment we have not found a suitable fix yet.

As we are also an agency, we have been very busy lately and thus have not been able to put time into solving this issue.

For that same reason we have no estimated time for a fix, however we are more then happy to accept pull requests to this repository that would resolve the issue.

We have attempted a solution that would include the component in the dist folder. This resolves the error mentioned above.
But however that seems to cause two new issues:

  • Sass becomes a dependency needed inside of the projects
  • Flags seem to not load

The work for this has been done in 7-fix-broken-svelte-build, if anyone wishes to attempt a fix from that you are more than welcome to.

@scippio
Copy link

scippio commented Dec 8, 2021

tip: For those who need flags in code (until this bug will be fixed) is there: flag-icon-css package ( https://github.com/lipis/flag-icons ) ... just add this to your main scss file:
@use 'flag-icon-css/css/flag-icons';
It's stable and works perfectly for years...

@Rar9
Copy link

Rar9 commented Mar 14, 2022

any update for sveltekit?

@alvinycheung
Copy link

Still a problem

@evankford
Copy link

It looks like the package/npm module isn't including the /src directory. As a result, any imports that are trying to resolve as a svelte entry are failing, because they're trying to resolve to /src/Flag.svelte, which isn't in the module at all.

In addition, the Flag.svelte component has some errors:

  1. Line 20: Wrong path to the ./dist folder.
  2. Line 41: <style type="text/css"> should be <style lang="scss">

I can confirm that copying the src directory into the npm module folder and then fixing these two errors resolves this issue for me. Obviously this isn't a solution for build-time, etc, but I'm happy to contribute a PR if I can get some confirmation from the owners that they're open to it!

@ChrizzDF
Copy link

I'd also love to use them!
@evankford I applied your mentioned steps but it still got me the error Identifier deep is expected when spinning up the server.

Anyway, I hope a fix gets released very soon! 🙏

@joekrump
Copy link

joekrump commented Nov 1, 2024

Still a problem

image

@joekrump
Copy link

joekrump commented Nov 1, 2024

Still a problem

image

Part of the root of the problem for me is that it seems like the component was probably compiled for svelte 3 and has some syntax that is unique to that.

If I do this

<script lang="ts">
  import Flag from "svelte-flagpack/dist/index.js";
</script>

<svelte:component this={Flag} code={option.countryAlpha3Code} size="S" />

Things do not blow up immediately but as soon as the dynamic import kicks off things blow up.

@joekrump
Copy link

joekrump commented Nov 1, 2024

Seems like this may be part of what is needed once this package is updated to support svelte >=4: https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants