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

fastclick polyfill 问题 #39

Closed
yangchongduo opened this issue Apr 12, 2018 · 1 comment
Closed

fastclick polyfill 问题 #39

yangchongduo opened this issue Apr 12, 2018 · 1 comment

Comments

@yangchongduo
Copy link

example 中的with-scss
引入了 yo3 框架报错


/Users/qitmac000068/Documents/yodemo2/assets-with-roadhog/node_modules/yo3/component/common/tapEventPluginInit.js:23
        _fastclick2.default.attach(document.body);
                            ^
TypeError: [egg-core] load file: /Users/qitmac000068/Documents/yodemo2/assets-with-roadhog/app/middleware/clientRoute.js, error: _fastclick2.default.attach is not a function
    at Object.<anonymous> (/Users/qitmac000068/Documents/yodemo2/assets-with-roadhog/node_modules/yo3/component/common/tapEventPluginInit.js:23:29)
    at Module._compile (module.js:652:30)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/qitmac000068/Documents/yodemo2/assets-with-roadhog/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
@njugray
Copy link
Contributor

njugray commented Apr 12, 2018

粗略地看了下yo3中的 fastclick 部分

polyfill 的时候 在window下挂载了 FastClick 对象, 源码中

        FastClick.attach(document.body);

直接使用 FastClick 肯定是会报错的, FastClick 并不在 global 下.

此处:
https://github.com/doyoe/Yo/blob/23c9c9e7376c1a6adfd828fb0e1e375b3011bbc4/component_dev/common/tapEventPluginInit.js#L8

尝试设置 ___yoTapEventInjected 绕过 FastClick 在 服务端的 polyfill 注入

@njugray njugray closed this as completed Apr 18, 2018
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