diff --git a/esbuild/build.mjs b/esbuild/build.mjs new file mode 100644 index 0000000..5dbb43b --- /dev/null +++ b/esbuild/build.mjs @@ -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" }); diff --git a/esbuild/package.json b/esbuild/package.json new file mode 100644 index 0000000..241f5e3 --- /dev/null +++ b/esbuild/package.json @@ -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 ", + "license": "MIT", + "devDependencies": { + "esbuild": "^0.8.23" + }, + "scripts": { + "build": "node --experimental-json-modules build.mjs" + }, + "engines": { + "node": ">=14.x" + } +} diff --git a/esbuild/src/index.ts b/esbuild/src/index.ts new file mode 100644 index 0000000..396c76b --- /dev/null +++ b/esbuild/src/index.ts @@ -0,0 +1 @@ +export default "Hello! esbuild"; diff --git a/esbuild/yarn.lock b/esbuild/yarn.lock new file mode 100644 index 0000000..cfdf300 --- /dev/null +++ b/esbuild/yarn.lock @@ -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==