Comments (6)
Would it be possible / worth updating the publicDir
property to additionally accept an array or record like entry
so we can manually map out multiple public / static asset (directories) that need to be copied.
Something like this:
import { defineConfig } from 'tsup';
export default defineConfig({
publicDir: [
'./src/assets/',
'./src/static/'
]
});
// OR
export default defineConfig({
publicDir: {
'./src/assets/': './dist/assets/',
'./src/static/': ({ output }) => `${output}/static/`
}
});
In theory I thought a work around for this would be to return an array of configs & just have multiple publicDir
's that way but with no entry point it does not work.
While --onSuccess "cp -a public/. dist"
works, there is a few things that aren't ideal about it:
- Desync with your output directory name (Though this could be fixed with a template string)
- CLI exec is not ideal & would be better if it was all done pragmatically. In the same way
rm -rf ./dist/
works, but not on Windows systems so people often userimraf
to add platform agnostic support.
from tsup.
This can be achieved with the onSuccess
option, like --onSuccess "cp -a public/. dist"
which copies everything inside public
folder to your dist
folder.
from tsup.
The --publicDir
argument will copy everything in the public
folder into the dist
folder.
https://tsup.egoist.dev/#copy-files-to-output-directory
from tsup.
How are folks dealing with this currently? Wrapper build script? Example?
from tsup.
Any progress on this feature?
from tsup.
Something I've noticed, cp public/ dist/ && tsup
will somehow delete the files copied in dist/public/
. However I found no mention of "public" in the doc. The solution is to do the copy after Tsup has built but that's kinda weird.
from tsup.
Related Issues (20)
- bug: experimentalDts generates .d.ts with syntax errors
- Got `Cannot find module '@swc/core'` error with v8.1.1 HOT 6
- typedoc page down in documentation
- [Bug] Cannot find src - 8.2.1 breaking changes HOT 3
- peer dependency issues when installing HOT 1
- Critical bug in version v8.2.1 HOT 2
- docs missing: skipNodeModulesBundle HOT 1
- How to watch a node_modules subdirectory? HOT 1
- Watch mode gives `SIGABRT` error once built HOT 3
- No DTS rebuild in watch mode HOT 2
- The v14Next.js Page router experiences a ReferenceError: requirement is not defined error
- Cannot start service: Host version "0.17.19" does not match binary version "0.18.20"
- Tailwind clashes with css modules
- svelte plugin error
- `import type { X as Y } from "@package";` - Import alias doesn't get build properly and get lost
- [Bug Report] When built as `cjs`, differing values of `splitting` can lead to inconsistent outputs from `await import()`.
- css file is removed in bundleless mode?
- Declaration files imports/exports from non-existing *.js files when outExtension is *.mjs HOT 1
- support `allowArbitraryExtensions`
- tsup is not working with `npx`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsup.