-
-
Notifications
You must be signed in to change notification settings - Fork 234
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 make css just be copied into dist #1287
Comments
Ran into the same issue. Did you find a solution? |
@Joseph2424 i ended up with config like this: import { globSync } from 'glob';
import path from 'path';
import { defineConfig } from 'tsup';
import { fileURLToPath } from 'url';
export default defineConfig({
entry: ['src/**/*.(ts|tsx|css)'],
format: ['esm'],
dts: {
entry: Object.fromEntries(
globSync('src/**/*.{ts,tsx}').map((file) => [
path.relative(
'src',
file.slice(0, file.length - path.extname(file).length)
),
fileURLToPath(new URL(file, import.meta.url)),
])
),
},
treeshake: true,
splitting: false,
clean: true,
sourcemap: true,
external: ['react', 'react-dom'],
loader: {
'.css': 'copy',
},
}); |
Unfortunately, adding "css" as an entry fails for me. However, removing css as an entry allows tsup to compile. Otherwise, I get an error saying css is not supported. ESM ⚡️ Build success in 877ms import { defineConfig } from 'tsup'; export default defineConfig((options) => ({ |
You are a life saver, I spent nearly a week trying to figure this out. Turns out the issue was with the DTS flag. I had it set to true initially. Instead I replaced it with your copy function and it worked. Thank You!!! |
I have config like this:
i have couple css files in src i need to package with code in dist.
i get this error on tsup build
DTS Build start error TS6054: File 'mycssfile.css' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'.
how can i tell dts to not process css files?
this seems to be not working anymore. rollup still process file https://github.com/egoist/tsup/blob/main/src/rollup.ts#L87
The text was updated successfully, but these errors were encountered: