Exclude JS files from copying with a .endsWith

Unfortunately, the src is relative on Unix-like systems and absolute on
Windows systems. I don't know who has decided for that bullshit, but
surely there must be a reason. For now, it's easier to just do a little
string comparison.
This commit is contained in:
nachtjasmin 2023-06-14 17:13:12 +02:00
parent 1a4f26c538
commit f169b79e3e
No known key found for this signature in database

View file

@ -13,14 +13,6 @@ const files = [
path.join("src", "options", "options.js"),
];
/**
* This array contains all files that we don't want to copy from the `src` folder.
* For now, only exact filenames are supported, neither directories, glob patterns or regular expressions.
*
* @type {string[]}
*/
const ignore = [];
/**
* @type {import("esbuild").BuildOptions}
*/
@ -49,7 +41,7 @@ export const defaultBuildOptions = {
recursive: true,
// Return true if the file should be copied and false otherwise.
filter: (src) => ![...files, ...ignore].includes(src),
filter: (src) => !src.endsWith(".js"),
}),
],
};