Skip to content

Commit

Permalink
feat: enhance build speed by esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonghakseo committed Jul 19, 2024
1 parent 12a2540 commit 3ef2d9a
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 18 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@typescript-eslint/parser": "^7.16.0",
"autoprefixer": "^10.4.19",
"cross-env": "^7.0.3",
"esbuild": "^0.23.0",
"eslint": "8.56.0",
"eslint-config-airbnb-typescript": "18.0.0",
"eslint-config-prettier": "9.1.0",
Expand Down
15 changes: 15 additions & 0 deletions packages/shared/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as esbuild from "esbuild"

/**
* @type { import("esbuild").BuildOptions }
*/
const buildOptions = {
entryPoints: ["./index.ts", "./lib/**/*.ts", "./lib/**/*.tsx"],
tsconfig: "./tsconfig.json",
bundle: false,
target: 'es6',
outdir: "./dist",
sourcemap: true,
}

await esbuild.build(buildOptions);
7 changes: 2 additions & 5 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
"files": [
"dist/**"
],
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "index.ts",
"main": "./dist/index.js",
"scripts": {
"clean": "rimraf ./dist",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"ready": "pnpm build:esm && pnpm build:cjs",
"ready": "node build.mjs",
"lint": "eslint . --ext .ts,.tsx",
"lint:fix": "pnpm lint --fix",
"prettier": "prettier . --write --ignore-path ../../.prettierignore",
Expand Down
15 changes: 15 additions & 0 deletions packages/ui/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as esbuild from "esbuild"

/**
* @type { import("esbuild").BuildOptions }
*/
const buildOptions = {
entryPoints: ["./index.ts","./tailwind.config.ts", "./lib/**/*.ts", "./lib/**/*.tsx"],
tsconfig: "./tsconfig.json",
bundle: false,
target: 'es6',
outdir: "./dist",
sourcemap: true,
}

await esbuild.build(buildOptions);
7 changes: 2 additions & 5 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@
"dist/global.css"
],
"types": "index.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"main": "./dist/index.js",
"scripts": {
"clean": "rimraf ./dist && rimraf .turbo",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"cp:css": "cp ./lib/global.css ./dist/global.css",
"ready": "pnpm build:esm && pnpm build:cjs && pnpm cp:css",
"ready": "node build.mjs && pnpm cp:css",
"lint": "eslint . --ext .ts,.tsx",
"lint:fix": "pnpm lint --fix",
"prettier": "prettier . --write",
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-config/lib/withPageConfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const watchOption = isDev ? {
buildDelay: 50,
chokidar: {
ignored:[
/\/packages\/.*\.(ts|tsx)$/,
/\/packages\/.*\.(ts|tsx|map)$/,
]
}
}: undefined;
Expand Down
Loading

0 comments on commit 3ef2d9a

Please sign in to comment.