main static file copy
See original GitHub issueIt seems the files
option is electron-builder.json
define the file from build
folder to dist\xxx-unpacked\resources\app
because I found out the main static files are not copied from src\main\static
to build\main\static
on win11, so I added below code to function buildMain()
in build.js
FileSystem.cpSync(Path.join(__dirname, '..', 'src', 'main', 'static'), Path.join(__dirname, '..', 'build', 'main', 'static'), {recursive:true});
Did you encounter this issue?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
nickjj/esbuild-copy-static-files - GitHub
An esbuild plugin to efficiently copy static files from a source directory to a destination directory. ✔️ Only copy files that changed (it...
Read more >How to copy static files to build directory with Webpack?
I'm trying to move from Gulp to Webpack . In Gulp I have task which copies all files and folders from /static/ folder...
Read more >parcel-plugin-static-files-copy - npm
ParcelJS plugin to copy static files from static dir to bundle directory.. Latest version: 2.6.0, last published: 2 years ago.
Read more >File.Copy Method (System.IO) - Microsoft Learn
Copy (String, String, Boolean) ... Copies an existing file to a new file. Overwriting a file of the same name is allowed. public:...
Read more >"copy-static-assets" task - Rush Stack
This task supplements the TypeScript transpiler by copying asset files into the output folder, so that they can be imported by .js files....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You made me think of a potentially better solution @immafrady 👍
We could check if the change happened to one of the static files. Copy only and only the static file that got changed & restart Electron after. When a change has been made outside of the static files, we don’t have to copy anything explicitly.
Update: Already implemented now in 4f3d845aef01df0f54f581981b2aa7fc46c0f0fc
This is unintended.
The following line of code is being fired when you spin up the dev server:
The electron-builder config is ignored when you work in a dev environment, electron-builder config is only used when you actually build the application for production / distributing. I didn’t encounter an issue with static files, I’m also on W11/MacOS. So your PR (#18) is incorrect, following the README on how static files should work.
A little side note that is missing from the README is that static files are only copied over ONCE after running
npm run dev
, if you added new files to the static directory you will need to restart your dev server. This is to prevent copying over static (potentionally big) files after every change.I’ll close this issue & PR with the assumption of that you didn’t restart your dev server. If that’s not the case and there’s actually another issue going on please re-open this 😄 I’ll also extend the readme with more details about this behavior.