我使用 webpack 加载依赖项,当我运行 npm run dev
命令时出现此错误:
Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: D:\www\playing-with-texture-projection-in-three-js\src\lib\WebGLApp.js: Unexpected character '#' ; export default class WebGLApp { #updateListeners = [] #tmpTarget = new THREE.Vector3() #rafID #lastTime constructor({ background = '#000', backgroundAlpha = 1, fov = 45, near = 0.01, far = 100, ...options } = {}) { this.rend ....... .......
我缺少什么(我使用纯 JavaScript 和一些库)?
最佳答案
正如 @PatrickHund 在评论中指出的,这是 EcmaScript 中的一项新功能。
您必须使用 babel-plugin-transform-class-properties
插件来转换它们。
关于javascript - 意外字符 '#',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59667292/