reactjs - 包裹构建失败 `bundle.scss:undefined:undefined: plugin is not a function`

标签 reactjs sass postcss parceljs

我正在为我的学习项目使用包裹打包器并尝试为其创建构建。我也在使用 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

任何建议对我来说都是真正的帮助,谢谢。

最佳答案

好像是 Parcel 的 nanocss 的一个 bug .我只能通过根本不缩小 css 来修复它,使用

parcel build --no-minify

关于reactjs - 包裹构建失败 `bundle.scss:undefined:undefined: plugin is not a function`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67951491/

相关文章:

javascript - 使用 ReactJs,当从 props 发送的父对象发生变化时,如何更新我的表单字段?

javascript - Gulp 单个文件上的 scss 源映射

html - 如何在事件时更改字体超棒的图标颜色

css - 如何使用 PostCSS 在 Vue 中导入全局 css?

javascript - google-map-react:元素类型无效:需要一个字符串

reactjs - 在 ReactJs 中添加查询参数时返回按钮不起作用

javascript - 如何取消ReactJS组件中对componentDidMount()的多次调用?

css - 嵌套主题组件 : apply styles depending on a theme class of the nearest themed parent, 忽略承载主题类的更深层次父级

css - 如何在 vscode 中将 .css 文件解析为 PostCSS?

带有 React 的 CSS 架构也可以被主题化