Comments (2)
Hello everyone, I am also facing the same problem now.
Firstly, I strongly agree with alexlafroscia's view. Through my observation, I found that the buildStart
and buildEnd
hooks were executed too early, so that the chunks module that was later executed would empty the output folder. You can change the hook of the copy plugin to closeBundle
to solve this problem. That's right, that's what I'm doing now. It works very well!
copy({
hook: "closeBundle",
targets: [
{ src: './dll/*', dest: 'dist/dll' },
]
}),
from rollup-plugin-copy.
I ran into this as well, but was able to work around it with the right hook
value.
What I observed was that upon starting the Vite dev server, nothing was copied, but once I killed the process the files would be copied. Upon looking further into the way that this package works, this makes sense, as it defaults to writing the files on buildEnd
. This seems to be called when the process is killed.
If I set the hook
to "buildStart"
, however, the files are copied at the point that the server starts.
So, I have a configuration like this, which seems to be working as I would expect it to!
import * as path from "node:path";
import copy from "rollup-plugin-copy";
/** @type {import('vite').UserConfig} */
export default {
plugins: [
copy({
targets: [
{
src: path.resolve(__dirname, "path/to/thing"),
dest: path.resolve(__dirname, "public/path/to/thing"),
},
],
hook: "buildStart",
copyOnce: true,
}),
],
};
from rollup-plugin-copy.
Related Issues (20)
- Negated patterns doesn't work correctly. HOT 1
- Has anyone been able to get this working in Sveltekit yet? HOT 3
- copy folder structure with flatten=false and ignore first levels HOT 3
- No error if target file does not exist
- The filter won't take effect when file transformed
- (copy plugin) Error: ENOENT: no such file or directory, chmod <filename> HOT 7
- copy occurs before generated bundle write when multi entry HOT 2
- unable to copy dot files from a directory ie. .htaccess HOT 1
- Symlinks HOT 2
- Move `@types/*` to `devDependencies`. HOT 3
- Create symlink instead of copy?
- The files in src cannot be obtained under the windows system HOT 3
- Rename does not let me alter the folder to which the file is written. HOT 1
- Please add your oss license text HOT 1
- `rename` option does not work in Rollup 4 HOT 1
- Compile typescript HOT 1
- Breaking dependency [email protected] HOT 3
- [Question] Is it possible to copy to a "hidden" folder?
- Filter Assets
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 rollup-plugin-copy.