Browse Source

feat: output ES modules for tree shaking

tags/0.1.2
Dany Sluijk 4 months ago
parent
commit
16b10b8c30
Signed by: dsluijk GPG Key ID: EEEBA79CCB6729B0
3 changed files with 18 additions and 15 deletions
  1. +4
    -4
      package.json
  2. +13
    -11
      rollup.config.js
  3. +1
    -0
      tsconfig.json

+ 4
- 4
package.json View File

@@ -2,9 +2,8 @@
"name": "teenyui",
"version": "0.1.0",
"description": "Tiny UI library for Preact",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts",
"module": "./dist/src/index.js",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"repository": "git@github.com:dsluijk/teenyui.git",
"author": "Dany Sluijk <me@dany.dev>",
@@ -26,10 +25,11 @@
"preact": "^10.5.5",
"rollup": "^2.33.1",
"rollup-plugin-postcss": "^3.1.8",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"stylelint": "^13.7.2",
"stylelint-config-sass-guidelines": "^7.1.0",
"typescript": "^4.0.3"
"typescript": "^4.0.5"
},
"peerDependencies": {
"preact": "^10.5.5"


+ 13
- 11
rollup.config.js View File

@@ -1,26 +1,28 @@
import typescript from "rollup-plugin-typescript2";
import postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";

export default {
input: "src/index.ts",
output: [
{
dir: "dist/esm",
format: "esm",
},
{
dir: "dist/cjs",
format: "cjs",
},
],
output: {
dir: "dist",
format: "esm",
sourcemap: true,
},
external: ["preact", "preact/hooks"],
preserveModules: true,
plugins: [
typescript({
module: "esnext",
module: "ESNext",
}),
postcss({
minimize: true,
modules: true,
}),
terser({
ecma: 2016,
module: true,
toplevel: true,
}),
],
};

+ 1
- 0
tsconfig.json View File

@@ -3,6 +3,7 @@
"noImplicitAny": true,
"sourceMap": true,
"declaration": true,
"declarationDir": "./dist",
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "node",


Loading…
Cancel
Save