Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SWRDevTools doesn't work with webpack v5 #40

Merged
merged 5 commits into from
Dec 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/swr-devtools-demo/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
4 changes: 2 additions & 2 deletions examples/swr-devtools-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"lint": "tsc --noEmit"
},
"dependencies": {
"next": "10.0.6",
"next": "^12.0.7",
"react": "17.0.2",
"react-dom": "17.0.2",
"styled-components": "^5.3.0",
"swr": "^1.0.0"
"swr": "^1.1.0"
},
"devDependencies": {
"@types/node": "^14.14.27",
Expand Down
24 changes: 8 additions & 16 deletions examples/swr-devtools-demo/pages/api/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,33 @@ const pages = {
1: [
{
name: "Array.prototype.at()",
url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at",
url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/at",
},
{
name: "Array.prototype.concat()",
url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
},
{
name: "Array.prototype.copyWithin()",
url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin",
url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin",
},
{
name: "Array.prototype.entries()",
url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries",
url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/entries",
},
{
name: "Array.prototype.every()",
url:
"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
url: "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every",
},
],
2: [
{
name: "HTMLElement.accessKey",
url:
"https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKey",
url: "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/accessKey",
},
{
name: "HTMLElement.contentEditable",
url:
"https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable",
url: "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable",
},
{
name: "HTMLElement.inert",
Expand All @@ -49,8 +42,7 @@ const pages = {
},
{
name: "HTMLElement.tabIndex",
url:
"https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex",
url: "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex",
},
],
3: [
Expand Down
3 changes: 2 additions & 1 deletion examples/swr-devtools-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true
},
"include": [
"next-env.d.ts",
Expand Down
1 change: 1 addition & 0 deletions examples/swr-devtools-demo/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/swr-devtools-panel/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib
lib
cjs
24 changes: 19 additions & 5 deletions packages/swr-devtools-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@
"name": "swr-devtools-panel",
"version": "0.3.0",
"description": "A React component for the SWR DevTools panel",
"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"
}
},
"license": "MIT",
"files": [
"lib"
"lib",
"cjs"
],
"author": "koba04",
"scripts": {
"start": "tsc --watch",
"clean": "rimraf lib",
"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-panel/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-panel/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
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
Loading