From 5fc633df3fb7154c72552907cd74f4057da2acbd Mon Sep 17 00:00:00 2001 From: jserfeng <1114550440@qq.com> Date: Mon, 11 Sep 2023 17:04:45 +0800 Subject: [PATCH] fix: use cjs version runtime addon --- packages/runtime/plugin-runtime/package.json | 19 +++++++++++++------ packages/runtime/plugin-testing/package.json | 8 ++++---- .../builder/src/addons/preset/preview.ts | 8 ++------ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/packages/runtime/plugin-runtime/package.json b/packages/runtime/plugin-runtime/package.json index 72a3f4d0579e..962c421f5335 100644 --- a/packages/runtime/plugin-runtime/package.json +++ b/packages/runtime/plugin-runtime/package.json @@ -27,6 +27,7 @@ ".": { "types": "./dist/types/index.d.ts", "jsnext:source": "./src/index.ts", + "require": "./dist/cjs/index.js", "default": "./dist/esm/index.js" }, "./types": "./types/index.d.ts", @@ -36,16 +37,19 @@ "./loadable": { "types": "./dist/types/exports/loadable.d.ts", "jsnext:source": "./src/exports/loadable.ts", + "require": "./dist/cjs/exports/loadable.js", "default": "./dist/esm/exports/loadable.js" }, "./head": { "types": "./dist/types/exports/head.d.ts", "jsnext:source": "./src/exports/head.ts", + "require": "./dist/cjs/exports/head.js", "default": "./dist/esm/exports/head.js" }, "./styled": { "types": "./dist/types/exports/styled.d.ts", "jsnext:source": "./src/exports/styled.ts", + "require": "./dist/cjs/exports/styled.js", "default": "./dist/esm/exports/styled.js" }, "./server": { @@ -76,6 +80,7 @@ "./model": { "types": "./types/model.d.ts", "jsnext:source": "./src/state/index.ts", + "require": "./dist/cjs/state/index.js", "default": "./dist/esm/state/index.js" }, "./cli": { @@ -86,11 +91,13 @@ "./router": { "types": "./dist/types/router/index.d.ts", "jsnext:source": "./src/router/index.ts", + "require": "./dist/esm/router/index.js", "default": "./dist/esm/router/index.js" }, "./router/server": { "types": "./dist/types/router/runtime/server.d.ts", "jsnext:source": "./src/router/runtime/server.ts", + "require": "./dist/cjs/router/runtime/server.js", "default": "./dist/esm/router/runtime/server.js" }, "./loadable-bundler-plugin": { @@ -160,12 +167,12 @@ "@loadable/component": "5.15.3", "@loadable/server": "5.15.3", "@loadable/webpack-plugin": "5.15.2", - "@modern-js-reduck/plugin-auto-actions": "^1.1.10", - "@modern-js-reduck/plugin-devtools": "^1.1.10", - "@modern-js-reduck/plugin-effects": "^1.1.10", - "@modern-js-reduck/plugin-immutable": "^1.1.10", - "@modern-js-reduck/react": "^1.1.10", - "@modern-js-reduck/store": "^1.1.10", + "@modern-js-reduck/plugin-auto-actions": "^1.1.11", + "@modern-js-reduck/plugin-devtools": "^1.1.11", + "@modern-js-reduck/plugin-effects": "^1.1.11", + "@modern-js-reduck/plugin-immutable": "^1.1.11", + "@modern-js-reduck/react": "^1.1.11", + "@modern-js-reduck/store": "^1.1.11", "@modern-js/plugin": "workspace:*", "@modern-js/types": "workspace:*", "@modern-js/utils": "workspace:*", diff --git a/packages/runtime/plugin-testing/package.json b/packages/runtime/plugin-testing/package.json index 9aebbaa3a87e..f890e0dcf427 100644 --- a/packages/runtime/plugin-testing/package.json +++ b/packages/runtime/plugin-testing/package.json @@ -119,10 +119,10 @@ "@babel/core": "^7.22.15", "@babel/preset-env": "^7.22.15", "@modern-js/babel-preset-app": "workspace:*", - "@modern-js-reduck/plugin-auto-actions": "^1.1.10", - "@modern-js-reduck/plugin-effects": "^1.1.10", - "@modern-js-reduck/plugin-immutable": "^1.1.10", - "@modern-js-reduck/store": "^1.1.10", + "@modern-js-reduck/plugin-auto-actions": "^1.1.11", + "@modern-js-reduck/plugin-effects": "^1.1.11", + "@modern-js-reduck/plugin-immutable": "^1.1.11", + "@modern-js-reduck/store": "^1.1.11", "@modern-js/babel-compiler": "workspace:*", "@modern-js/utils": "workspace:*", "@modern-js/plugin": "workspace:*", diff --git a/packages/storybook/builder/src/addons/preset/preview.ts b/packages/storybook/builder/src/addons/preset/preview.ts index 818ec5d8b079..e9cb9fd95482 100644 --- a/packages/storybook/builder/src/addons/preset/preview.ts +++ b/packages/storybook/builder/src/addons/preset/preview.ts @@ -1,7 +1,3 @@ -// import { withPluginRuntime } from '../withPluginRuntime'; +import { withPluginRuntime } from '../withPluginRuntime'; -// FIXME: @modern-js/runtime now is ESM only, but this package -// currently focus on CommonJS, so it cannot import @modern-js/runtime -// directly. -// export const decorators = [withPluginRuntime]; -export const decorators = []; +export const decorators = [withPluginRuntime];