This is my simple project structure:
.
├── build
│ ├── settings.js
│ ├── build.js
│ ├── serve.js
├── src
│ ├── scripts
| | ├── index.ts
| | ├── ...
│ ├── styles
| | ├── style.scss
| | ├── ...
├── www
│ ├── index.html
│ ├── style.css
│ ├── index.js
├── tsconfig.json
├── node_modules
├── package.json
├── package-lock.json
-
settings.js
:import esbuildPluginTsc from "esbuild-plugin-tsc"; export function createSettings(options) { return { entryPoints: ["../src/scripts/"], bundle: true, outdir: "../www", plugins: [ esbuildPluginTsc({ tsconfigPath: "../tsconfig.json", force: true, }), ], ...options, }; }
-
build.js
:import * as esbuild from "esbuild"; import { createBuildSettings } from "./settings.js"; const settings = createBuildSettings({ minify: true }); await esbuild.build(settings);
Execution of node build/build.js
fails with this error:
✘ [ERROR] Could not resolve "../src/scripts/index.ts"
I tried to solve that using tiny-glob
according to Could not resolve esbuild entry points like so:
export async function createSettings(options) {
return {
entryPoints: await glob("../src/scripts/*.ts"),
...
}
This attempt also failed and await glob("../src/scripts/*.ts")
only returns :
node:internal/modules/run_main:123
triggerUncaughtException(
^
[Error: ENOENT: no such file or directory, scandir 'C:UsersusernameDesktopsrcscripts'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\Users\username\Desktop\src\scripts'
}