From 36b6980f333b74595cc6f6c70a436f6d6460de05 Mon Sep 17 00:00:00 2001 From: Igor Kowalczyk Date: Sat, 27 May 2023 10:17:04 +0200 Subject: [PATCH] Fix build output --- package.json | 4 ++-- src/readme.md | 10 ++++++++++ src/{index.cjs => source.cjs} | 0 src/{index.mjs => source.mjs} | 0 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/readme.md rename src/{index.cjs => source.cjs} (100%) rename src/{index.mjs => source.mjs} (100%) diff --git a/package.json b/package.json index 0f88878..4c3c501 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "scripts": { "format": "prettier --write . --ignore-unknown --cache", "format:check": "prettier --check . --cache", - "build:esm": "esbuild index.mjs --platform=node --format=esm --minify --outfile=dist/index.mjs", - "build:cjs": "esbuild index.cjs --platform=node --format=cjs --minify --outfile=dist/index.js", + "build:esm": "esbuild src/source.mjs --platform=node --format=esm --minify --outfile=dist/index.mjs", + "build:cjs": "esbuild src/source.cjs --platform=node --format=cjs --minify --outfile=dist/index.js", "build": "pnpm run build:esm && pnpm run build:cjs", "lint": "eslint . --ext .js,.ts", "lint:fix": "eslint . --ext .js,.ts --fix" diff --git a/src/readme.md b/src/readme.md new file mode 100644 index 0000000..d53ef6c --- /dev/null +++ b/src/readme.md @@ -0,0 +1,10 @@ +### Why 2 source files? + +- Tailwind.css in version 3.3 introduced ESM support. Building the ESM file doesn't work, Tailwind.css needs plain output. So we have to build the ESM file and the CJS file separately. + +``` +npm run build:esm +npm run build:cjs +``` + +If you found a better solution, please let me know. \ No newline at end of file diff --git a/src/index.cjs b/src/source.cjs similarity index 100% rename from src/index.cjs rename to src/source.cjs diff --git a/src/index.mjs b/src/source.mjs similarity index 100% rename from src/index.mjs rename to src/source.mjs