@ray-js/code-sandbox 0.0.3-beta-7 → 0.0.3-beta-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ export const postSandboxCode = (iframe, code, title) => {
6
6
  payload: {
7
7
  code: Base64.encode(`RJSEventChannel.emit('sandbox-jsrun', '${Base64.encode(`
8
8
  var exports = {};
9
+ var module = { exports: {} };
9
10
  function require(id) {
10
11
  if(typeof id === 'string' && id.startsWith('@tuya-miniapp/icons/')) {
11
12
  const comName = id.split('/').pop()
@@ -23,7 +24,11 @@ export const postSandboxCode = (iframe, code, title) => {
23
24
  const childrenNode = __ctx__.react.createElement(exports.default)
24
25
  if(__ctx__.React.isValidElement(childrenNode)) {
25
26
  __ctx__.___setContent___(childrenNode);
27
+ } else {
28
+ console.log('[codesandbox] 不是正确的react节点,加载失败', childrenNode)
26
29
  }
30
+ } else {
31
+ console.log('[codesandbox] 没有默认导出,加载失败', exports)
27
32
  }
28
33
  }, 500)
29
34
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/code-sandbox",
3
- "version": "0.0.3-beta-7",
3
+ "version": "0.0.3-beta-8",
4
4
  "description": "小程序 CodeSandbox 容器",
5
5
  "main": "lib/index",
6
6
  "files": [