From cb13e874a28854f04c16179f9dbcabccbf340229 Mon Sep 17 00:00:00 2001 From: Shen Chang Date: Thu, 16 May 2019 08:55:51 +0800 Subject: [PATCH] style: output cjs files --- .gitignore | 1 + package.json | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index dfc35e6..4633ae3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules coverage es/** +cjs/** diff --git a/package.json b/package.json index fa6f654..4affa85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-keep-alive", - "version": "2.0.1", + "version": "2.0.2", "description": "Package will allow components to maintain their status, to avoid repeated re-rendering.", "author": "Shen Chang", "homepage": "https://github.com/Sam618/react-keep-alive", @@ -17,15 +17,18 @@ "bugs": { "url": "https://github.com/Sam618/react-keep-alive/issues" }, - "main": "es/index.js", + "main": "cjs/index.js", + "module": "es/index.js", "scripts": { - "clean": "rimraf es", + "clean:es": "rimraf es", + "clean:cjs": "rimraf cjs", "test": "jest", "codecov": "codecov", "build:demo": "webpack", - "build:es": "npm run clean && tsc", + "build:es": "npm run clean:es && tsc", + "build:cjs": "npm run clean:cjs && tsc --outDir cjs --module commonjs", "start:demo": "webpack-dev-server --hot --historyApiFallback", - "start:es": "npm run clean && tsc -w -sourcemap --outDir es" + "start:es": "npm run clean:es && tsc -w -sourcemap --outDir es" }, "husky": { "hooks": { @@ -69,6 +72,11 @@ "webpack-cli": "^3.2.3", "webpack-dev-server": "^3.1.14" }, + "peerDependencies": { + "react": ">=16.3.0", + "react-dom": ">=16.3.0", + "react-router-dom": ">=5.0.0" + }, "config": { "commitizen": { "path": "./node_modules/cz-conventional-changelog"