-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
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
[ appservice 生成错误] dist/components/iconfont/index.weapp.js: #41
Comments
taro info 贴一下吧,谢谢 |
Taro CLI 3.1.0-beta.4 environment info: |
无论是在npm run dev还是npm run build编译后,微信开发工具里总是出现index.weapp.js文件中的这段代码有报错:
Taro Info 如下: |
//index.weapp.js
`/* eslint-disable */
import React from 'react';
import Taro from '@tarojs/taro';
const IconFont = (props) => {
const { name, size, color } = props;
return ;
};
IconFont.defaultProps = {
size: 18,
};
export default IconFont;`
微信开发工具报错如下:
错误一:
app.js错误:
Error: module "app.js" is not defined
at require (VM43 WAService.js:2)
at :3:7
at doWhenAllScriptLoaded (appservice?t=1604853668269:9863)
at HTMLScriptElement.scriptLoaded (appservice?t=1604853668269:9883)
at HTMLScriptElement.script.onload (appservice?t=1604853668269:9891)
错误二:
[ appservice 生成错误] dist/components/iconfont/index.weapp.js: file: components/iconfont/index.weapp.js
unknown: Unexpected token (9:9)
7 | const { name, size, color } = props;
8 |
有遇到过这类问题吗?
后来在组件的config.json文件中添加:
usingComponents: {"iconfont": "../../components/iconfont"},
并去掉app.config.json文件中的:**usingComponents: Object.assign(useGlobalIconFont())**后,以上报错会消失,显示新的报错,如下:
[ dist/pages/detail/detail.json 文件内容错误] dist/pages/detail/detail.json: ["usingComponents"]["IconFont"]: "../../components/iconfont/index.weapp" 未找到
接着删掉组件config.json中的usingComponents配置项,并恢复app.config.json文件中的usingComponents配置项,重新编译后页面才可以显示图标,无报错。
每次重启编译都会出现以上问题。
The text was updated successfully, but these errors were encountered: