mirror of
https://github.com/kou029w/_.git
synced 2025-01-31 06:18:07 +00:00
create esbuild sample
This commit is contained in:
parent
ed3c8133f3
commit
051687976a
4 changed files with 37 additions and 0 deletions
10
esbuild/build.mjs
Normal file
10
esbuild/build.mjs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { readFile } from "fs/promises";
|
||||||
|
import esbuild from "esbuild";
|
||||||
|
const { build } = esbuild;
|
||||||
|
const entryPoint = "src/index.ts";
|
||||||
|
const { main: cjs, module: esm } = JSON.parse(
|
||||||
|
await readFile(new URL("./package.json", import.meta.url))
|
||||||
|
);
|
||||||
|
const base = { entryPoints: [entryPoint], sourcemap: true, bundle: true };
|
||||||
|
build({ ...base, outfile: esm, format: "esm" });
|
||||||
|
build({ ...base, outfile: cjs, format: "cjs" });
|
18
esbuild/package.json
Normal file
18
esbuild/package.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "@kou029w/esbuild",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "dist/kou029w-esbuild.cjs.js",
|
||||||
|
"module": "dist/kou029w-esbuild.esm.js",
|
||||||
|
"sideEffects": false,
|
||||||
|
"author": "Kohei Watanabe <kou029w@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"esbuild": "^0.8.23"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "node --experimental-json-modules build.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.x"
|
||||||
|
}
|
||||||
|
}
|
1
esbuild/src/index.ts
Normal file
1
esbuild/src/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export default "Hello! esbuild";
|
8
esbuild/yarn.lock
Normal file
8
esbuild/yarn.lock
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
esbuild@^0.8.23:
|
||||||
|
version "0.8.23"
|
||||||
|
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.8.23.tgz#8c4ccd3abb5f7b4ae9f31c571971517be4ae60d2"
|
||||||
|
integrity sha512-LkgCmotGnhVgRGxjDkTBBYrnJ5stcxK+40cEJGtXUS16hcAWy90cn1qjxKCogzLPJ75gW/L6ejly7VKrMstVGQ==
|
Loading…
Add table
Reference in a new issue