Browse Source

add build:cjs script

Yuki Takei 3 years ago
parent
commit
4dd5c99616
2 changed files with 20 additions and 0 deletions
  1. 2 0
      packages/ui/package.json
  2. 18 0
      packages/ui/tsconfig.build.cjs.json

+ 2 - 0
packages/ui/package.json

@@ -6,12 +6,14 @@
   "keywords": [
     "growi"
   ],
+  "main": "dist/cjs/index.js",
   "module": "dist/esm/index.js",
   "files": [
     "dist"
   ],
   "scripts": {
     "build": "run-p build:*",
+    "build:cjs": "tsc -p tsconfig.build.cjs.json && tsc-alias -p tsconfig.build.cjs.json",
     "build:esm": "tsc -p tsconfig.build.esm.json && tsc-alias -p tsconfig.build.esm.json",
     "clean": "npx -y shx rm -rf dist",
     "lint:js": "eslint **/*.{js,jsx,ts,tsx}",

+ 18 - 0
packages/ui/tsconfig.build.cjs.json

@@ -0,0 +1,18 @@
+{
+  "extends": "./tsconfig.base.json",
+  "compilerOptions": {
+    "module": "commonjs",
+
+    "rootDir": "./src",
+    "outDir": "dist/cjs",
+    "declaration": true,
+    "noResolve": false,
+    "preserveConstEnums": true,
+    "sourceMap": false,
+    "noEmit": false,
+
+    "baseUrl": ".",
+    "paths": {
+    }
+  }
+}