vue 引入import * as Potree from "potree-core"报错 in ./node_modules/potree-core/dist/index.js Module parse failed: Unexpected token (1:243107) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders (Source code omitted for this binary file)
时间: 2024-04-06 12:31:48 浏览: 107
这个错误提示意思是Webpack没有正确处理`potree-core`库中的文件。解决这个问题,你需要在Webpack配置中增加一个loader来处理`.js`文件。如果你的项目是使用Vue CLI创建的,那么你可以在`vue.config.js`文件中添加以下代码:
```javascript
module.exports = {
configureWebpack: {
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
}
}
```
这会让Webpack使用`babel-loader`来处理`.js`文件,从而避免上述错误。如果你的项目不是使用Vue CLI创建的,你需要手动修改Webpack配置文件。
阅读全文