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

[BUG] Issue Building with Vite #6

Closed
TheBigRoomXXL opened this issue Aug 23, 2022 · 1 comment
Closed

[BUG] Issue Building with Vite #6

TheBigRoomXXL opened this issue Aug 23, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@TheBigRoomXXL
Copy link

I have installed the plugin with a package manager and created a basic component :

<div x-data="tabs">
  <link rel="stylesheet" href="/assets/classless.css">
  <nav>
    <ul>
      <img alt="app_logo"
       src="../assets/logo.svg" />
      <span style="font-size: 1.5em ">rlog</span>
      <template x-for="tab in tabs">
        <li x-text="tab"></li>
      </template>
      <img class="float-right" alt="RFC logo" src="../assets/Logo_RFC_Couleur_Blanc.png"  />
    </ul>
  </nav>
</div>

I use it inside my index.html

<x-component-wrapper 
      x-component
      url="../components/Navbar.html"
></x-component-wrapper>

When I use npm run dev (vite --host 0.0.0.0 --port 3000) it work fine but when I use npm run build (vite build) it break because the url "../components/Navbar.html" doesn't exist anymore.

I try fixing that by adding the component to the static assets with assetsInclude: ['/components/*.html'] in vite.config.js but it didn't work for several reasons :

  • A hash is added to the file name
  • The file is then stored in the assets folder, not 'components/'
  • The links inside are not process so there are broken

Is there a way to fix that so I can steel use Vite to build?

My vite.config.js

import { resolve } from 'path'
import { defineConfig } from 'vite'

export default defineConfig({ 
  root : resolve(__dirname, 'app/'),
  build: {
    outDir : resolve(__dirname, 'dist/'),
    emptyOutDir: true,
  }
})

Thank you!

@markmead
Copy link
Owner

Hey @TheBigRoomXXL 👋

Sorry I missed this. Just for future reference, make sure you assign an issue/PR to get attention.

I've not used Vite like this, do you have an example repo?

@markmead markmead self-assigned this Aug 31, 2022
@markmead markmead changed the title Building with vite? [BUG] Issue Building with Vite Aug 31, 2022
@markmead markmead added the bug Something isn't working label Aug 31, 2022
@markmead markmead closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2022
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

2 participants