gpt4 book ai didi

babeljs - 错误错误 : A constructor name should not start with a lowercase letter babel/new-cap

转载 作者:行者123 更新时间:2023-12-03 17:05:36 26 4
gpt4 key购买 nike

好吧,我对 Babel 有一个误报。

这是控制台中的错误。

ERROR in ./src/app/playlist/playlist.js

/Users/macbook-lucas/refreex/src/app/playlist/playlist.js
6:23 error A constructor name should not start with a lowercase letter babel/new-cap

✖ 1 problem (1 error, 0 warnings)

@ ./src/app/playlist/index.js 12:16-37
@ ./src/index.js

这是代码:
import {webtorrent} from 'webtorrent';

class PlaylistController {
contructor() {
this.TorrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4';
this.Client = new webtorrent();
}
}

export const playlist = {
templateUrl: "app/playlist/playlist.html",
controller: PlaylistController,
bindings: {
playlist: '<'
}
};

最佳答案

就像 rici 说的:

我对 Babel 一无所知,但我的直觉告诉我们,表达式 new foo() 应该构造一个 foo 类的对象。因此,如果类名必须以大写字母开头,则必须是 new Foo()。或 new Webtorrent(),在您的情况下(请参阅第 6 行,根据错误消息)。 ——

关于babeljs - 错误错误 : A constructor name should not start with a lowercase letter babel/new-cap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40210632/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com