1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00

create esbuild sample

This commit is contained in:
Nebel 2020-12-18 12:40:53 +09:00
parent ed3c8133f3
commit 051687976a
4 changed files with 37 additions and 0 deletions

10
esbuild/build.mjs Normal file
View 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
View 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
View file

@ -0,0 +1 @@
export default "Hello! esbuild";

8
esbuild/yarn.lock Normal file
View 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==