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

Doc #162

Closed
wants to merge 3 commits into from
Closed

Doc #162

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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Doc](https://heluxjs.github.io/helux)
- [Playground](https://heluxjs.github.io/helux/playground)
- [Helux-react-starter](https://codesandbox.io/p/sandbox/helux-react-starter-ts-539scq)
- [Helux-openinula-starter](https://codesandbox.io/p/devbox/helux-openinula-66gfj2)
- [Helux-preact-starter](https://codesandbox.io/p/sandbox/helux-preact-starter-dnyzpy)
- [Helux-nextjs-starter](https://github.com/heluxjs/helux-nextjs-starter)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"scripts": {
"build": "turbo run build",
"build:watch": "turbo run build:watch",
"build_devtool": "pnpm --filter=helux-devtool run build",
"build_devtool": "pnpm --filter=@helux/plugin-devtool run build",
"build_helux": "pnpm --filter=helux run build",
"changeset": "changeset",
"commitlint": "commitlint -e $HUSKY_GIT_PARAMS",
Expand Down
10 changes: 6 additions & 4 deletions packages/helux-plugin-devtool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helux/plugin-devtool",
"version": "4.0.1",
"version": "4.0.3",
"description": "devtool for helux",
"bugs": {
"url": "https://github.com/heluxjs/helux/issues"
Expand Down Expand Up @@ -31,15 +31,17 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"helux": "workspace:^",
"helux": "^4.2.0",
"redux": "^4.2.1"
},
"peerDependencies": {},
"bundleDependencies": false,
"publishConfig": {
"access": "public",
"main": "dist/index.js",
"registry": "https://registry.npmjs.org/"
},
"deprecated": false
"deprecated": false,
"devDependencies": {
"terser": "^5.29.1"
}
}
9 changes: 7 additions & 2 deletions packages/helux-plugin-devtool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ const moduleInfoMap: Record<string, { name: string; state: any }> = {
[pluginName]: { name: pluginName, state: 'init helux devtool' }, // 避免调试时再刷新浏览器出现 no store 错误导致 devtool 无法启动
};

function getWindow() {
// @ts-ignore
return window || global;
}

function createReducer(module: string, initState = {}) {
return function (state: any, action: any) {
if (state === undefined) state = initState;
Expand All @@ -34,10 +39,10 @@ function tryInjectReduxDevTool() {
const redecers = createReducers();
if (!Object.keys(redecers).length) return;

const g = getWindow(); // global this
reduxStore = createStore(
combineReducers(redecers),
// @ts-ignore
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
g.__REDUX_DEVTOOLS_EXTENSION__ && g.__REDUX_DEVTOOLS_EXTENSION__(),
);
injected = true;

Expand Down
Loading
Loading