Raw and inline asset loader support #631
-
|
We are migrating a Monaco-based playground over and are using tsup currently. That seems to work in the original repository but as part of migrating over to our core repo, I thought we'd take a look at tsdown. It seems we need some special handling of In tsup we passed In tsdown I made a new config and it seems to not support those inline and raw import statements. tsdown.config.ts import { defineConfig } from 'tsdown'
export default defineConfig({
entry: '../src/engine/index.ts',
dts: true,
tsconfig: '../src/engine/tsconfig.json',
outDir: './types',
loader: {'.glsl': 'text'}
})output Should this be supported? Are we doing something weird? The tsup output I get is: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
|
We use Vite for the main build and it looks like that supports (through esbuild?) the |
Beta Was this translation helpful? Give feedback.
-
|
Query parameters (?raw, ?inline) not supported in tsdown yet. The loader config only handles extension mapping. Rolldown underneath supports it via plugins, but tsdown doesn't expose this. Feature gap - use loader: {'.glsl': 'text'} as workaround without query params. |
Beta Was this translation helpful? Give feedback.
-
|
You can try https://github.com/unplugin/unplugin-raw plugin for |
Beta Was this translation helpful? Give feedback.
After reviewing your PR excaliburjs/Excalibur#3598, I noticed you're using tsup to bundle the playground, correct? However, tsup doesn't handle
?inlineproperly, it simply converts.css?inlineto:which isn't correct.
Currently, both tsdown and tsup have limited support for CSS. If you only need dts types, you can externalize your CSS imports.
https://tsdown.dev/options/dependencies#external