Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.5k stars 3.05k forks source link

_core.default is not a constructor #2201

Open cielu opened 5 years ago

cielu commented 5 years ago

thirdScriptError sdk uncaught third Error _core.default is not a constructor TypeError: _core.default is not a constructor at http://127.0.0.1:60174/appservice/common/eventHub.js:14:16 at require (http://127.0.0.1:60174/appservice/__dev__/WAService.js:1:1113027) at http://127.0.0.1:60174/appservice/__dev__/WAService.js:1:1112637 at http://127.0.0.1:60174/appservice/app.js:7:40 at require (http://127.0.0.1:60174/appservice/__dev__/WAService.js:1:1113027) at :1:1 at HTMLScriptElement.scriptLoaded (http://127.0.0.1:60174/appservice/appservice?t=1561042240005:1401:21) at HTMLScriptElement.script.onload (http://127.0.0.1:60174/appservice/appservice?t=1561042240005:1413:20)

Gcaufy commented 5 years ago

缺少版本信息和代码片段,无法定位

cielu commented 5 years ago

缺少版本信息和代码片段,无法定位

就是最新版的,@wepy/core 2.0.0-alpha 使用第三方包的时候就会报这个错

    pages: [
      'pages/index'
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black'
    },
    usingComponents: {
    'van-nav-bar': '../node_modules/vant-weapp/lib/nav-bar/index'
    },
Gcaufy commented 5 years ago

第三方包的引用方式如下:

usingComponents: {
    'van-nav-bar': 'module:vant-weapp/lib/nav-bar/index'
}
cielu commented 5 years ago

第三方包的引用方式如下:

usingComponents: {
    'van-nav-bar': 'module:vant-weapp/lib/nav-bar/index'
}

@Gcaufy 谢谢

cielu commented 5 years ago

@Gcaufy 不过好像还有个bug,就是我新建的文件夹他没给我搞过去,就比如images ,生成的时候自动忽略了它

cielu commented 5 years ago

@Gcaufy 好像还是一样的。。

image

image

cielu commented 5 years ago

image

cielu commented 5 years ago

在app里面全局引用组建的时候,好像没有导入进来

cielu commented 5 years ago

image

cielu commented 5 years ago

image

cielu commented 5 years ago

改为原有写法正常 image

image

Gcaufy commented 5 years ago

@Gcaufy 不过好像还有个bug,就是我新建的文件夹他没给我搞过去,就比如images ,生成的时候自动忽略了它

https://wepyjs.github.io/wepy-docs/2.x/#/cli/config?id=static

静态资源配置一下 static 选项。

Gcaufy commented 5 years ago

@cielu wxs 的引用问题在最近的版本中已经fix https://github.com/Tencent/wepy/issues/2069

cielu commented 5 years ago

@Gcaufy 我是用的12版的,但是还有这问题啊。。。

另外使用全局组建 ,组建不会导入到 $vendor 文件夹里面啊

zhuman90 commented 5 years ago

@Gcaufy 我是用的12版的,但是还有这问题啊。。。

另外使用全局组建 ,组建不会导入到 $vendor 文件夹里面啊

vant可以正常引入的,你@wepy/cli要升级到最新版本2.0.0-alpha.12,我刚开始也遇见你这个问题了,现在正常

cielu commented 5 years ago

@Gcaufy 引入全局组件未导入的问题呢?其他的好像正常了 image

cielu commented 5 years ago

我在app.wpy使用了 commen/eventHub 就会出现_core.default 的问题 image

image

@Gcaufy 还是这个问题,不知道哪里出现的, 这个

var eventHub = new _core["default"]();
var _default = eventHub;
exports["default"] = _default;

改成

exports["default"] = _core["default"];

就正常了