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

wxml报错 #1

Closed
cz848 opened this issue Aug 14, 2017 · 6 comments
Closed

wxml报错 #1

cz848 opened this issue Aug 14, 2017 · 6 comments

Comments

@cz848
Copy link

cz848 commented Aug 14, 2017

运行webpack报错
ERROR in ./src/pages/detail/detail.wxml
Module not found: Error: Can't resolve '../../icons/{{icons[key]}}.svg' in '……/src/pages/detail'
@ ./src/pages/detail/detail.wxml
跟路径无关,好像是不能识别{{icons[key]}},也不知道是不是此插件造成的,能否帮忙定位一下?

@Cap32
Copy link
Owner

Cap32 commented Aug 15, 2017

确实是因为不能识别 {{icons[key]}} 导致的问题,webpack 在编译时无法知道 {{icons[key]}} 的值。

暂时想到的妥协方案是不处理动态引入(含{{}}的路径),用户自己通过 copy-webpack-plugin 之类的插件 copy 引用的文件到 dist 目录。

@cz848
Copy link
Author

cz848 commented Aug 15, 2017

那就不能压缩文件了是吧

@Cap32
Copy link
Owner

Cap32 commented Aug 16, 2017

我发布了新版,不处理动态引入的资源文件 3ea5c69 ,使 webpack 不报错。

这只是一个妥协的临时解决方案,周末有空会完善一个更好的解决方案。😁

@Cap32 Cap32 closed this as completed Aug 16, 2017
@Cap32
Copy link
Owner

Cap32 commented Aug 16, 2017

压缩问题,可以先用微信开发者工具自带的压缩功能,问题不大

@cz848
Copy link
Author

cz848 commented Aug 16, 2017

OK,非常感谢

@maikro-v
Copy link

resolve.alias定义的图片别名也没办法解析码?

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

No branches or pull requests

3 participants