nx-plugins
nx-plugins copied to clipboard
copy plugin constructs an incorrect destination path and fails to copy the file there
encountered a weird bug, where the file name of the destination path is removed from the constructed path.
plugin setup:
copyPlugin({
resolveFrom: 'cwd',
assets: [{
from: 'public/**/*.json',
to: 'dist/'
}],
verbose: true,
copyOnStart: true,
watch: true,
}),
cwd is in D:\GIT\myapp\
esbuild version: 0.17.10
copy plugin version: 2.1.0
output log:
i File copied: D:\GIT\myapp\public\collections\config.json -> D:\GIT\myapp\dist\collections\config.json
i File copied: D:\GIT\myapp\public\collections\config.schema.json -> D:\GIT\myapp\dist\collections\config.schema.json
i File copied: D:\GIT\myapp\public\collections\editor.json -> D:\GIT\myapp\dist\collections\editor.json
X [ERROR] EPERM: operation not permitted, copyfile 'D:\GIT\myapp\public\collections\publication-type.json' -> 'D:\GIT\myapp\dist\collections' [plugin plugin:copy]
node_modules/esbuild/lib/main.js:1334:4:
1334 │ await Promise.all(onStartCallbacks.map(async ({ name, callback, note }) => {
╵ ^
at Object.copyFileSync (node:fs:2817:3)
at copyOperationHandler (file:///D:/GIT/myapp/node_modules/esbuild-plugin-copy/dist/index.mjs:60:26)
at file:///D:/GIT/myapp/node_modules/esbuild-plugin-copy/dist/index.mjs:122:17
at Array.forEach (<anonymous>)
at executor (file:///D:/GIT/myapp/node_modules/esbuild-plugin-copy/dist/index.mjs:121:18)
at file:///D:/GIT/myapp/node_modules/esbuild-plugin-copy/dist/index.mjs:143:13
at async D:\GIT\myapp\node_modules\esbuild\lib\main.js:1336:22
at async Promise.all (index 0)
at async requestCallbacks.on-start (D:\GIT\myapp\node_modules\esbuild\lib\main.js:1334:5)
at async handleRequest (D:\GIT\myapp\node_modules\esbuild\lib\main.js:723:13)
esbuild running in watch mode produces the same output source files are readable, destionation folder is clean, and writeable.
Tried to rename the publication-type.json
json to something completely different, then it errors with a different file named publication.json
. I dont know if filenames are relevant or not. My public
folder contains these files:
assets\bootstrap.min.css
assets\forest.jpg
assets\react-dom.development.js
assets\react-dom.production.min.js
assets\react.development.js
assets\react.production.min.js
collections\charts.json
collections\config.json
collections\config.schema.json
collections\editor.json
collections\publication-type.json
collections\publication.json
collections\publication.ui.json
collections\UISchema\editor-UISchema.json
index.html
this plugin seems great and does exactly what we need, so I would be happy if this could be fixed!
Managed to workaround by adding ./
prefix to the paths :
copyPlugin({
resolveFrom: 'cwd',
assets: [{
from: './public/**/*',
to: './dist'
}],
verbose: true,
copyOnStart: true,
watch: true,
}),
This way it works as intended.
Can you provide me with a minimum reproduction example? I tried to restore your project structure locally, but I didn't find the expected error reporting 🙏.