?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
低版本沒(méi)發(fā)現(xiàn)有問(wèn)題
問(wèn)題原因:因?yàn)閷?dǎo)入的組件庫(kù)是直接上源碼的,必須告知webpack,需要編譯一下這個(gè)庫(kù),讓源碼中的es6、es7的特性轉(zhuǎn)換為es5
解決方案:
1.在vue.config.js?里面加上?transpileDependencies: [‘/@pixi/’]
module.exports = {
? ? ?transpileDependencies: [‘/@name/’]
}
name? ? 找報(bào)錯(cuò)的node_modules 里依賴(lài)的路徑???@ ./node_modules/@pixi/assets/lib/index.mjs 20:0-77 20:0-77?文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-665031.html
?參考:項(xiàng)目無(wú)法識(shí)別 ?. 語(yǔ)法,導(dǎo)致報(bào)錯(cuò)Module parse failed: Unexpected token文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-665031.html
到了這里,關(guān)于Vue3安裝pixi.js 項(xiàng)目無(wú)法識(shí)別 ?. 語(yǔ)法,導(dǎo)致報(bào)錯(cuò)Module parse failed: Unexpected token的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!