Skip to content

Commit

Permalink
Move bundling to tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisen committed Jan 6, 2023
1 parent f108848 commit 125c2c0
Show file tree
Hide file tree
Showing 4 changed files with 615 additions and 24 deletions.
14 changes: 3 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
"name": "react-blurhash",
"version": "0.2.0",
"description": "Blurhash implementation for React",
"keywords": [
"blurhash",
"blur",
"hash",
"image",
"react",
"component"
],
"keywords": ["blurhash", "blur", "hash", "image", "react", "component"],
"license": "MIT",
"author": "nygardk",
"repository": {
Expand All @@ -22,10 +15,8 @@
"module": "es/index.js",
"scripts": {
"prepublishOnly": "npm run build",
"build": "npm run build:es && npm run build:lib",
"build": "tsup",
"build:demo": "rm -rf ./docs && webpack -p --config webpack.demo.config.js",
"build:es": "rm -rf ./es && npm run ts -- --module es2015 --outDir ./es",
"build:lib": "rm -rf ./lib && npm run ts -- --module commonjs --outDir ./lib --esModuleInterop true",
"demo": "webpack-dev-server --config webpack.demo.config.js --hot --progress",
"prettier": "prettier src/**/*.ts",
"prettier-fix": "npm run prettier -- --write",
Expand All @@ -49,6 +40,7 @@
"react-hot-loader": "^4.13.0",
"styled-components": "^5.2.0",
"ts-loader": "8.0.6",
"tsup": "^6.5.0",
"typescript": "4.0.3",
"webpack": "4.44.2",
"webpack-cli": "3.3.12",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"lib": ["es5", "dom"],
"target": "es6",
"lib": ["esnext", "dom"],
"declaration": true,
"outDir": "./lib",
"sourceMap": true,
Expand Down
37 changes: 37 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineConfig } from 'tsup';

export default defineConfig([
{
name: 'main',
entry: ['./src/index.ts'],
outDir: './lib',
format: ['cjs'],
legacyOutput: true,
sourcemap: true,
clean: true,
splitting: false,
dts: false,
minify: true,
},
{
name: 'esm',
entry: ['./src/index.ts'],
outDir: './es',
format: ['esm'],
legacyOutput: false,
sourcemap: true,
clean: true,
splitting: false,
dts: false,
minify: true,
},
{
name: 'typedefs',
entry: ['./src/index.ts'],
outDir: './lib',
clean: false,
dts: {
only: true,
},
},
]);
Loading

0 comments on commit 125c2c0

Please sign in to comment.