Skip to content

Backend Integration: Load transpiled TypeScript/SASS assets via dev server #16508

Closed Answered by ffraenz
ffraenz asked this question in Q&A
Discussion options

You must be logged in to vote

I was able to solve the issue by disabling publicDir. It might have interfered with the delivery of transpiled assets. Also, I noticed, that the Vite client needs to be loaded first, before Vite starts transpiling entrypoints. Refreshing the TypeScript asset without hitting the Vite client before, shows the original file. That was misleading during debugging. Now I get consistent results.

Here's my updated vite.config.ts:

import path from 'node:path'
import { defineConfig } from 'vite'

export default defineConfig({
  publicDir: false,
  build: {
    manifest: true,
    outDir: path.resolve(__dirname, 'public/content/themes/theme/assets/dist'),
    emptyOutDir: true,
    sourcemap: true,

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ffraenz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant