Skip to content

copy: looks like not support copy filename  #110

@bluelovers

Description

@bluelovers
#!/usr/bin/env node

import { build } from 'esbuild'
import { join } from 'path'
import { copy } from 'esbuild-plugin-copy';
import { main as outfile_main } from './package.json';

import { sassPlugin } from 'esbuild-sass-plugin'
import { __ROOT, __ROOT_OUTPUT } from './test/__root';

(async () => {
	console.log(`build`, __ROOT_OUTPUT)
	console.log(`outfile`, outfile_main)

	await build({
		entryPoints: [
			join(__ROOT, 'src/index.mts')
		],
		outfile: join(__ROOT_OUTPUT, 'javascript', outfile_main),
		bundle: true,
		plugins: [
			sassPlugin({
				type: "css-text",
			}),
			copy({
				assets: [
					{
						from: [
							'./scripts/**/*'
						],
						to: [
							'./output/scripts'
						],
					},
					{
						from: [
							'./README\.md',
							'LICENSE',
						],
						to: [
							'./output'
						],
					},
					{
						from: [
							'./\.github',
						],
						to: [
							'./output/.github'
						],
					},
				],
				verbose: true,
				resolveFrom: __ROOT,
			}),
		],
		platform: 'browser',
		treeShaking: true,
		sourcemap: true,
		// @ts-ignore
		//analyze: true,
		legalComments: 'none',
		allowOverwrite: true,
		minifySyntax: true,
		format: 'iife',
		minify: Boolean(process.env['ESBUILD_MINIFY'])
	})
})();

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions