-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
The plugin consistently crashes for me on windows when I modify a watched file. I believe this is due to some path regularization.
My config
copy({
resolveFrom: 'cwd',
assets: [
{
from: './assets/profile_pics/*',
to: './build/www/',
},
{
from: './assets/card_images/*',
to: './build/www/',
watch: isDevServer,
},
{
from: './assets/favicon.png',
to: './build/www/',
},
],
verbose: true,
watch: isDevServer,
}),
Error in verbose mode (with an additional console.log added my me showing the undefined preserved dir structure
[watch-client] i [File Changed] File assets\card_images\ArtArcher.jpg changed, copy operation triggered.
[watch-client] i The from path ./assets/card_images/* of current asset pair doesnot ends with /**/*(.ext),
[watch-client] preservedDirStructure: undefined, globbedFromPath: assets\card_images\ArtArcher.jpg, startFragment: ./assets/card_images, sourcePath: C:\Users\Zack\Programming\mythos\assets\card_images\ArtArcher.jpg
[watch-client] file:///C:/Users/Zack/Programming/mythos/node_modules/esbuild-plugin-copy/dist/index.mjs:55
[watch-client] preservedDirStructure.slice(1)
[watch-client] ^
[watch-client]
[watch-client] TypeError: Cannot read properties of undefined (reading 'slice')
[watch-client] at copyOperationHandler (file:///C:/Users/Zack/Programming/mythos/node_modules/esbuild-plugin-copy/dist/index.mjs:55:29)
[watch-client] at file:///C:/Users/Zack/Programming/mythos/node_modules/esbuild-plugin-copy/dist/index.mjs:140:17
[watch-client] at Array.forEach (<anonymous>)
[watch-client] at FSWatcher.<anonymous> (file:///C:/Users/Zack/Programming/mythos/node_modules/esbuild-plugin-copy/dist/index.mjs:139:18)
[watch-client] at FSWatcher.emit (node:events:513:28)
[watch-client] at FSWatcher.emitWithAll (C:\Users\Zack\Programming\mythos\node_modules\chokidar\index.js:540:8)
[watch-client] at FSWatcher._emit (C:\Users\Zack\Programming\mythos\node_modules\chokidar\index.js:632:8)
[watch-client] at listener (C:\Users\Zack\Programming\mythos\node_modules\chokidar\lib\nodefs-handler.js:389:18)
[watch-client] at C:\Users\Zack\Programming\mythos\node_modules\chokidar\lib\nodefs-handler.js:271:49
[watch-client] at foreach (C:\Users\Zack\Programming\mythos\node_modules\chokidar\lib\nodefs-handler.js:41:5)
[watch-client]
[watch-client] Node.js v18.12.1
Specifically looking at the log I added
preservedDirStructure: undefined, globbedFromPath: assets\card_images\ArtArcher.jpg, startFragment: ./assets/card_images, sourcePath: C:\Users\Zack\Programming\mythos\assets\card_images\ArtArcher.jpg
preservedDirStructure is undefined because the globbedFromPath = assets\card_images\ArtArcher.jpg is missing the prepended ./ and uses windows \ instead of my configs /.
Metadata
Metadata
Assignees
Labels
No labels