{"action":"created","issue":{"url":"https://api.github.com/repos/Tencent/wepy/issues/1033","repository_url":"https://api.github.com/repos/Tencent/wepy","labels_url":"https://api.github.com/repos/Tencent/wepy/issues/1033/labels{/name}","comments_url":"https://api.github.com/repos/Tencent/wepy/issues/1033/comments","events_url":"https://api.github.com/repos/Tencent/wepy/issues/1033/events","html_url":"https://github.com/Tencent/wepy/issues/1033","id":302153393,"number":1033,"title":"sdk uncaught third Error   regeneratorRuntime is not defined","user":{"login":"ScriptPower","id":7435656,"avatar_url":"https://avatars2.githubusercontent.com/u/7435656?v=4","gravatar_id":"","url":"https://api.github.com/users/ScriptPower","html_url":"https://github.com/ScriptPower","followers_url":"https://api.github.com/users/ScriptPower/followers","following_url":"https://api.github.com/users/ScriptPower/following{/other_user}","gists_url":"https://api.github.com/users/ScriptPower/gists{/gist_id}","starred_url":"https://api.github.com/users/ScriptPower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScriptPower/subscriptions","organizations_url":"https://api.github.com/users/ScriptPower/orgs","repos_url":"https://api.github.com/users/ScriptPower/repos","events_url":"https://api.github.com/users/ScriptPower/events{/privacy}","received_events_url":"https://api.github.com/users/ScriptPower/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-05T02:36:01Z","updated_at":"2018-03-05T02:41:29Z","closed_at":"2018-03-05T02:40:16Z","author_association":"NONE","body":"import的es6模块文件中使用了async/await, 使用wepybuild后，在微信开发者工具中报如下错误\r\n\r\n```\r\n thirdScriptError \r\n sdk uncaught third Error \r\n regeneratorRuntime is not defined \r\n ReferenceError: regeneratorRuntime is not defined\r\n    at http://127.0.0.1:54188/appservice/lib/king/account/loginInfo/index.js:10:46\r\n    at http://127.0.0.1:54188/appservice/lib/king/account/loginInfo/index.js:47:2\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002\r\n    at http://127.0.0.1:54188/appservice/lib/king/account/index.js:7:18\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002\r\n    at http://127.0.0.1:54188/appservice/lib/king/index.js:8:16\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002`\r\n```\r\n\r\n更改wepy.config.js配置，增加了如下配置项后\r\n\r\n```\r\ncompilers: {\r\n    babel: {\r\n      sourceMap: !prod,\r\n      presets: [\r\n        'env'\r\n      ],\r\n      plugins: [\r\n        ['transform-runtime', { //导致 Cannot read property 'createTextNode' of undefined\r\n          'helpers': false,\r\n          'polyfill': true,\r\n          'regenerator': true,\r\n          'moduleName': 'babel-runtime'\r\n        }],\r\n        'transform-class-properties',\r\n        'transform-decorators-legacy',\r\n        'transform-object-rest-spread',\r\n        'transform-export-extensions',\r\n        'transform-async-to-generator'\r\n      ]\r\n    }\r\n  }\r\n```\r\n\r\n又出现了 Cannot read property 'createTextNode' of undefined\r\n\r\n```\r\nthirdScriptError \r\n sdk uncaught third Error \r\n Cannot read property 'createTextNode' of undefined \r\n TypeError: Cannot read property 'createTextNode' of undefined\r\n    at module.exports (http://127.0.0.1:54188/appservice/npm/core-js/library/modules/_microtask.js:36:24)\r\n    at http://127.0.0.1:54188/appservice/npm/core-js/library/modules/es6.promise.js:13:43\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002\r\n    at http://127.0.0.1:54188/appservice/npm/core-js/library/fn/promise.js:4:1\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002\r\n    at http://127.0.0.1:54188/appservice/npm/babel-runtime/core-js/promise.js:1:299\r\n    at require (http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16253)\r\n    at http://127.0.0.1:54188/appservice/__dev__/WAService.js:18:16002`\r\n```\r\n\r\n小程序禁止访问直接访问window和document, 而上述/npm/core-js/library/modules/_microtask.js 中的代码为探测运行环境使用了document.createTextNode, 从而导致异常。\r\n\r\n有谁知道如何解决么？\r\n"},"comment":{"url":"https://api.github.com/repos/Tencent/wepy/issues/comments/370294250","html_url":"https://github.com/Tencent/wepy/issues/1033#issuecomment-370294250","issue_url":"https://api.github.com/repos/Tencent/wepy/issues/1033","id":370294250,"user":{"login":"ScriptPower","id":7435656,"avatar_url":"https://avatars2.githubusercontent.com/u/7435656?v=4","gravatar_id":"","url":"https://api.github.com/users/ScriptPower","html_url":"https://github.com/ScriptPower","followers_url":"https://api.github.com/users/ScriptPower/followers","following_url":"https://api.github.com/users/ScriptPower/following{/other_user}","gists_url":"https://api.github.com/users/ScriptPower/gists{/gist_id}","starred_url":"https://api.github.com/users/ScriptPower/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScriptPower/subscriptions","organizations_url":"https://api.github.com/users/ScriptPower/orgs","repos_url":"https://api.github.com/users/ScriptPower/repos","events_url":"https://api.github.com/users/ScriptPower/events{/privacy}","received_events_url":"https://api.github.com/users/ScriptPower/received_events","type":"User","site_admin":false},"created_at":"2018-03-05T02:41:29Z","updated_at":"2018-03-05T02:41:29Z","author_association":"NONE","body":"就是基于 wepy init standard 创建的项目。\r\n并且app.apy文件中已声明：\r\nconstructor () {\r\n    super()\r\n    this.use('requestfix') // 避免同时多请求\r\n    this.use('promisify')  // 解决promise\r\n  }\r\n"}}
{"actor":{"display_login":"ScriptPower"}}