I am trying to copy some assets files from an npm package into ./dist/assets
import { build } from 'esbuild';
import { copy } from 'esbuild-plugin-copy';
await build({
entryPoints: ['./src/index.ts'],
bundle: true,
format: 'esm',
outfile: './dist/index.js',
plugins: [
copy({
verbose: true,
resolveFrom: 'out',
assets: [
{
from: './node_modules/some-package/dist/esm/*.worker*.js',
to: './assets/' // still copies files into ./dist
}
]
})
],
}).catch(() => process.exit(1));
Instead of copying to ./dist/assets it copies to ./dist. Here is the verbose output:
i Resolve assert pair to path from: /Users/.../esbuild/dist
i Use Merge-Structure for current assets pair.
i File copied: /Users/.../dist/esm/format.worker-28fe4aab.js -> /Users/.../esbuild/dist/format.worker-28fe4aab.js
i File copied: /Users/.../dist/esm/format.worker-51010d22.js -> /Users/.../esbuild/dist/format.worker-51010d22.js
If I try to use to: './dist/assets' it copies to ./dist/dist instead.
i Resolve assert pair to path from: /Users/.../esbuild/dist
i Use Merge-Structure for current assets pair.
i File copied: /Users/.../dist/esm/format.worker-28fe4aab.js -> /Users/.../esbuild/dist/dist/format.worker-28fe4aab.js
i File copied: /Users/.../dist/esm/format.worker-51010d22.js -> /Users/.../esbuild/dist/dist/format.worker-51010d22.js
I am trying to copy some assets files from an npm package into
./dist/assets
Instead of copying to
./dist/assets
it copies to./dist
. Here is the verbose output:If I try to use
to: './dist/assets'
it copies to./dist/dist
instead.I have no idea what's happening...