We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
问题描述: 运行命令yarn dev:mp-weixin后,控制台会报错Charts.Charts is not a constructor.代码片段如下
yarn dev:mp-weixin
*** lib.js***
function Charts() { // do something } Charts.prototype.init = function() {} module.exports = Charts;
pages/index.vue
<template> <view></view> </template> <script> import Charts from './lib' onLoad() { const charts = new Charts(); } </script>
修改lib.js中的导出方式为export default Charts,问题就能正确处理。
export default Charts
这个应该属于uni模块中vite的编译问题,我们项目上一个版本中使用HBUilderx编译无问题。
The text was updated successfully, but these errors were encountered:
你的意思是自定义 js,你使用 cjs 的导出,功能有问题,改为 esm 导出是正常的对吗?你的上一个版本是那个版本,也是 alpha 吗
Sorry, something went wrong.
上一个版本是指的使用Hbuilder运行的项目,现在的使用cli。
试下使用@rollup/plugin-commonjs插件配合是否解决
No branches or pull requests
环境:
问题描述:
运行命令
yarn dev:mp-weixin
后,控制台会报错Charts.Charts is not a constructor.代码片段如下相关代码
*** lib.js***
pages/index.vue
问题处理:
修改lib.js中的导出方式为
export default Charts
,问题就能正确处理。分析
这个应该属于uni模块中vite的编译问题,我们项目上一个版本中使用HBUilderx编译无问题。
The text was updated successfully, but these errors were encountered: