Skip to content

Commit

Permalink
feat(swr-devtools): support module and exports fields
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Dec 5, 2021
1 parent bae681e commit 264ddeb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/swr-devtools/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib
lib
cjs
29 changes: 24 additions & 5 deletions packages/swr-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
"name": "swr-devtools",
"version": "0.3.0",
"description": "A React component for SWR DevTools",
"main": "lib/index.js",
"main": "cjs/index.js",
"module": "lib/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./lib/index.js",
"require": "./cjs/index.js",
"types": "./lib/index.d.ts"
},
"./lib/swr-cache": {
"import": "./lib/swr-cache.js",
"require": "./cjs/swr-cache.js",
"types": "./lib/swr-cache.d.ts"
}
},
"license": "MIT",
"files": [
"lib"
"lib",
"cjs"
],
"keywords": [
"swr"
Expand All @@ -18,10 +33,14 @@
"homepage": "https://github.com/koba04/swr-devtools",
"bugs": "https://github.com/koba04/swr-devtools/issues",
"scripts": {
"clean": "rimraf lib",
"start": "tsc --watch",
"clean": "rimraf lib cjs",
"start": "run-p start:*",
"start:cjs": "tsc -p tsconfig.cjs.json --watch",
"start:esm": "tsc --watch",
"prebuild": "yarn clean",
"build": "tsc",
"build": "run-p build:*",
"build:esm": "tsc",
"build:cjs": "tsc -p tsconfig.cjs.json",
"lint": "tsc --noEmit"
},
"peerDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions packages/swr-devtools/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./cjs",
}
}
2 changes: 1 addition & 1 deletion packages/swr-devtools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"module": "es2020", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"lib": ["dom", "es2017"], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
Expand Down

0 comments on commit 264ddeb

Please sign in to comment.