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

Svelte-kit package doesn't bundle css imports which are outside lib directory. #3109

Closed
SandipNirmal opened this issue Dec 26, 2021 · 1 comment
Labels
pkg:svelte-package Issues related to svelte-package

Comments

@SandipNirmal
Copy link

Describe the bug

I am creating a svelte-kit component library using svelte-kit package which packages everything from lib directory into a svelte package. I've a css file in src directory which I am importing in components. But when packaging css file is not copied to package directory.

Reproduction

Create a svelte-kit app with following structure.

src
 |
 |
 ___ index.css
 |
 ___ lib
      |
      |
      ___ Button.svelte
      |
      ___ index.js 

content of index.js

import './../index.css';

export {default as Button} from './Button.svelte'

When I am packaging this I expect css to be copied over since it's imported inside lib. But it doesn't.

Logs

No response

System Info

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 1.42 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 16.13.1 - /usr/local/Cellar/node@16/16.13.1/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 8.1.2 - /usr/local/Cellar/node@16/16.13.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 94.1.30.89
    Chrome: 96.0.4664.110
    Firefox: 92.0.1
    Safari: 15.2


### Severity

serious, but I can work around it

### Additional Information

_No response_
@SandipNirmal SandipNirmal changed the title Svelte-kit package doesn't bundle css imports from outside lib directory. Svelte-kit package doesn't bundle css imports which are outside lib directory. Dec 26, 2021
@ignatiusmb
Copy link
Member

This is expected as package command only looks at the contents of src/lib and copies them across as-is, see https://kit.svelte.dev/docs#packaging and its caveats.

You will need to move the css file inside src/lib or wait for #2572 to be resolved.

@ignatiusmb ignatiusmb added the pkg:svelte-package Issues related to svelte-package label Dec 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:svelte-package Issues related to svelte-package
Projects
None yet
Development

No branches or pull requests

2 participants