Library styles in custom element component and discarded in instantiated component #10344
              
                Unanswered
              
          
                  
                    
                      FilipJakab
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 2 replies
-
| This is expected because Svelte's  | 
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
I am doing a PoC with custom elements in Svelte. It involves single component marked as custom element that uses
photoviewerlibrary to preview images.Library's directions are to add
@use 'photoviewer'into styles:Which resulted in following style output:

As you can see, all acutal class names of the library are missing and only the svelte style's "hash" remained.
When I try same component with the last style configuration mentioned inside
App.svelte(as standard component, not as custom element)it works...
Reproduction
https://github.com/FilipJakab/image-viewer
Just run
npm iandnpm run devApp runs on port
5173where there are 2image-viewerinstances, first insideApp.svelteas a regular component and second as custom element inindex.html.Clicking on the first one initiates library and opens image's preview, while the second image does instantiate the library but without styles...
Logs
No response
System Info
System: OS: Linux 6.7 Arch Linux CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor Memory: 37.73 GB / 62.71 GB Container: Yes Shell: 5.9 - /bin/zsh Binaries: Node: 18.12.0 - ~/.asdf/installs/nodejs/18.12.0/bin/node Yarn: 1.22.21 - /usr/bin/yarn npm: 8.19.2 - ~/.asdf/plugins/nodejs/shims/npm npmPackages: svelte: ^4.2.8 => 4.2.9Beta Was this translation helpful? Give feedback.
All reactions