Skip to content

Commit

Permalink
feat: ✨ 添加rollup打包
Browse files Browse the repository at this point in the history
  • Loading branch information
hackers267 committed Aug 1, 2022
1 parent 00f7cb0 commit 620135b
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 8 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"build": "rollup -c rollup.config.js",
"clean": "rimraf dist types",
"release": "standard-version",
"test": "jest",
"test:o": "jest -o"
},
"files": [
"dist",
"types"
"dist"
],
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.4",
"@types/jest": "^28.1.6",
"jest": "^28.1.3",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"rollup": "^2.77.2",
"standard-version": "^9.5.0",
"ts-jest": "^28.0.7",
"typescript": "^4.7.4"
Expand Down
136 changes: 133 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import typescript from "@rollup/plugin-typescript";
import commonjs from "@rollup/plugin-commonjs";

export default {
input: "src/index.ts",
output: {
dir: "dist",
format: "esm",
},
plugins: [typescript(), commonjs()],
external: ["rxjs"],
};
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "ESNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
Expand Down Expand Up @@ -65,7 +65,7 @@
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
"declarationDir": "./types", /* Specify the output directory for generated declaration files. */
"declarationDir": "./dist", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */

/* Interop Constraints */
Expand Down

0 comments on commit 620135b

Please sign in to comment.