首页 > 解决方案 > Parcel 构建失败`bundle.scss:undefined:undefined: plugin is not a function`

问题描述

我正在为我的学习项目使用包裹捆绑器并尝试为其创建构建。我也在使用 scss 文件。在bundle.scss我已经导入了我所有的 scss 文件。并bundle.scss导入App.js.

所以在运行时parcel build index.html,我收到以下错误。

  /src/style/bundle.scss:undefined:undefined: plugin is not a function
    at LazyResult.run (/usr/local/lib/node_modules/parcel-bundler/node_modules/postcss/lib/lazy-result.js:288:14)
    at LazyResult.asyncTick (/usr/local/lib/node_modules/parcel-bundler/node_modules/postcss/lib/lazy-result.js:212:26)
    at /usr/local/lib/node_modules/parcel-bundler/node_modules/postcss/lib/lazy-result.js:254:14
    at new Promise (<anonymous>)
    at LazyResult.async (/usr/local/lib/node_modules/parcel-bundler/node_modules/postcss/lib/lazy-result.js:250:23)
    at LazyResult.then (/usr/local/lib/node_modules/parcel-bundler/node_modules/postcss/lib/lazy-result.js:131:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxxxx complete: `parcel build index.html`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the xxxxx complete script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /.npm/_logs/2021-06-12T17_37_55_156Z-debug.log

我的项目结构

src/
-App.js
-styles/
--bundle.scss
--app.scss
-index.html

任何建议都会对我有真正的帮助,谢谢。

标签: reactjssasspostcssparceljs

解决方案


这似乎是 Parcel 中的一个错误nanocss。我只能通过根本不缩小css来修复它,使用

parcel build --no-minify

推荐阅读