我从一个 SPA 转成 mpvue 后,运行 npm run dev 后,控制台报错,但是是报的 loader 的错误,实在不好排查是哪里的问题,有人遇到过吗?
TypeError: Cannot read property 'type' of undefined
at C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:34:24
at Selector.each (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\postcss-selector-parser\dist\selectors\container.js:153:22)
at C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:24:20
at Root.each (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\postcss-selector-parser\dist\selectors\container.js:153:22)
at Processor.func (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:22:19)
at Processor.process (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\postcss-selector-parser\dist\processor.js:34:14)
at rewriteSelector (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:56:10)
at Root.each (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\container.js:110:22)
at C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:8:10
at LazyResult.run (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:277:20)
at LazyResult.asyncTick (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:192:32)
at LazyResult.asyncTick (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:204:22)
at LazyResult.asyncTick (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:204:22)
at processing.Promise.then._this2.processed (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:231:20)
at new Promise (<anonymous>)
at LazyResult.async (C:\Users\vimcaw\Documents\Work\kcshop-mpvue\node_modules\@f-loat\mpvue-loader\node_modules\postcss\lib\lazy-result.js:228:27)
我从一个 SPA 转成 mpvue 后,运行
npm run dev
后,控制台报错,但是是报的 loader 的错误,实在不好排查是哪里的问题,有人遇到过吗?离报错点最近的代码(node_modules\@f-loat\mpvue-loader\lib\style-compiler\plugins\scope-id.js:34:24):
貌似大概是深度选择符 /deep/ 相关的报错,n 缺失 next 属性,打印出报错前最近的 n 的值,为:
看起来像是 /deep/ 之后是空的导致没有 next 属性,但是我的项目中并不会出现这种语法错误。
而且如果是语法错误的话,那应该在旧项目上就会报错,但是旧项目上是没问题的。