问题描述
我在我的网站上使用 Plyr.js,我需要删除库的 plugins.js 和 captions.js 以减小包大小,正如您在 bundle image 中看到的那样。
现在我已经尝试过 import {setup} from 'plyr'
、import Plyr from "plyr/dist/plyr"
、import Plyr from "plyr/src/js/plyr";
。
前两个对包大小没有影响,第三个给出了这个错误:
/node_modules/plyr/src/js/plyr.js
SyntaxError: C:\VSCode Projects\kasbarg\node_modules\plyr\src\js\plyr.js: Support for the experimental Syntax 'classproperties' isn't currently enabled (358:8):
356 | * Play the media,or play the advertisement (if they are not blocked)
357 | */
> 358 | play = () => {
| ^
359 | if (!is.function(this.media.play)) {
360 | return null;
361 | }
Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is,add @babel/plugin-Syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.
这里是 plyr
文件夹结构:first second third
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)