error in ./node_modules/@pixi/assets/lib/resolver/parsers/resolveTextureUrl.mjs
Module parse failed: Unexpected token (9:62)
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
| test: loadTextures.test,
| parse: (value) => ({
> resolution: parseFloat(settings.RETINA_PREFIX.exec(value)?.[1] ?? "1"),
| format: value.split(".").pop(),
| src: value
@ ./node_modules/@pixi/assets/lib/index.mjs 20:0-77 20:0-77
pixi.js 是最新版本,7.2.4
低版本没发现有问题
问题原因:因为导入的组件库是直接上源码的,必须告知webpack,需要编译一下这个库,让源码中的es6、es7的特性转换为es5
解决方案:
1.在vue.config.js 里面加上 transpileDependencies: [‘/@pixi/’]
module.exports = {
transpileDependencies: [‘/@name/’]
}
name 找报错的node_modules 里依赖的路径 @ ./node_modules/@pixi/assets/lib/index.mjs 20:0-77 20:0-77 文章来源:https://www.toymoban.com/news/detail-665031.html
参考:项目无法识别 ?. 语法,导致报错Module parse failed: Unexpected token文章来源地址https://www.toymoban.com/news/detail-665031.html
到了这里,关于Vue3安装pixi.js 项目无法识别 ?. 语法,导致报错Module parse failed: Unexpected token的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!