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

How to work with monorepo? #59

Open
numfin opened this issue Nov 7, 2024 · 2 comments
Open

How to work with monorepo? #59

numfin opened this issue Nov 7, 2024 · 2 comments

Comments

@numfin
Copy link

numfin commented Nov 7, 2024

Vite

I have 2 projects:

  1. Component library with svg-spritemap plugin. Everything works, storybook works, etc.
  2. Main app - no icons showing.

After investigating - I found that app inserting /assets/spritemap... which is correct path inside component library dist folder, but my main app doesn't know anything about /assets/spritemap....

So I'm wondering what kind of magic I have to do to tell vite to dynamically insert spritemap path into xlink-href.

Shortly

Now: localhost:5173/assets/spritemap.svg
I want: localhost:5173/@fs/path_to_uikit/dist/assets/spritemap.svg

@numfin
Copy link
Author

numfin commented Nov 7, 2024

After beating my head for a while i found "solution" which was working for me:
vite.config.ts

export default defineConfig(({command}) => ({
  base: command === "build" ? join("/@fs", __dirname, "dist") : "/",

@numfin
Copy link
Author

numfin commented Nov 13, 2024

Ok this "solution" worked only in devserver so manual file copying with vite-plugin-static-copy fixed it for me:

    viteStaticCopy({
      targets: [{ src: 'relative_path_to_package/dist/assets/*.svg', dest: './assets/' }],
    })

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

1 participant