Skip to content
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

你好,使用omi-mp编译报错 #397

Closed
coderguohuo opened this issue Jun 24, 2019 · 9 comments
Closed

你好,使用omi-mp编译报错 #397

coderguohuo opened this issue Jun 24, 2019 · 9 comments

Comments

@coderguohuo
Copy link

Failed to compile
./src/mp/pages/index/index.js
Syntax error: C:/Users/no1/my-app/src/mp/pages/index/index.js: Unexpected token (174:0)

172 | customElements.define('we-index', Element)
173 |

174 | }
| ^
175 | class Element extends WeElement {
176 | data = mpOption().data
177 |

@dntzhang
Copy link
Collaborator

编译出的 index.js贴出来了看下

@coderguohuo
Copy link
Author

谢谢,现在木有这个错了。
现在是Compiled successfully! 了,可是老报这个错:
[1] Failed to compile.
[1]
[1] ./src/mp/pages/among/among.js
[1] Module not found: You attempted to import /img/friend-badge.png which falls
outside of the project src/ directory. Relative imports outside of src/ are not
supported. You can either move it inside src/, or add a symlink to it from proje
ct's node_modules/. 我看了src下的mp下我的资源目录img是有这些资源的啊,为什么啊

@dntzhang
Copy link
Collaborator

看上去是图片没有 copy 到 src 内部

@coderguohuo
Copy link
Author

有啊,我检查了小程序内的所有的img都copy进去了的

@dntzhang
Copy link
Collaborator

那么你的 import 的路径写得有问题,不要写绝对路径。要写成 ../ 或者 ./ 开头的

@coderguohuo
Copy link
Author

是的,大佬。解决了!
不支持这个wx.createInnerAudioContext啊

@dntzhang
Copy link
Collaborator

h5 不支持吧?需要自己修改 src/mp 下的源码扩展下

@coderguohuo
Copy link
Author

怎么扩展的,不懂啊,求指点,或者有木有别的实现方法
SyntaxError: Failed to execute 'define' on 'CustomElementRegistry': "we-recordDetail" is not a valid custom element name
./src/mp/pages/recordDetail/recordDetail.js
F:/app-to-h5/src/mp/pages/recordDetail/recordDetail.js:194
191 | }
192 |
193 |

194 | customElements.define('we-recordDetail', Element)
195 |
196 |
197 |
这个是什么问题

@dntzhang
Copy link
Collaborator

we-recordDetail 要改成小写 we-recorddetail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants