【问题标题】:Postcss in Parcel-bundler does not work; No CSS modules usedParcel-bundler 中的 Postcss 不起作用;没有使用 CSS 模块
【发布时间】:2021-07-07 04:05:15
【问题描述】:

我正在使用 Parcel-bundler@1.12.3,通过 npm 安装。

我的 CSS 是通用的纯 CSS,没有任何模块或 SASS 或任何使用的东西。

“包裹索引.html”完美运行。

但是,当运行“parcel build index.html --no-content-hash --out-dir public --no-cache --no-source-maps --public-url ./”时,parcel 开始自动安装 postcss 和所有依赖项。然后抛出这个错误。

我已尝试禁用所有原始 CSS 并为我的 index.html 使用虚拟 CSS,但问题仍然存在。

test.css

body {
background-image: linear-gradient(90deg, #303133, #303133);
font-family: 'Open Sans', sans-serif;
font-weight: 200;
min-height: 100vh;
margin: 0;
color: #d3d3d3;
}

错误:

C:\Users...\frontend\styles\test.css:undefined:undefined: 插件不是函数 在 LazyResult.run (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:288:14) 在 LazyResult.asyncTick (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:212:26) 在 C:...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:254:14 at new Promise () 在 LazyResult.async (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:250:23) 在 LazyResult.then (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:131:17)

Error msg in console

【问题讨论】:

    标签: html css postcss parcel


    【解决方案1】:

    遇到同样的问题,并且能够解决它

    我在node_modules/parcel-bundler/ 中重新安装了postcss 到版本8.2.7

    就我而言

    cd C:/Program Files/nodejs/node_modules/parcel-bundler
    npm i postcss@8.2.7
    

    我的 style.scss 文件构建成功

    【讨论】:

      猜你喜欢
      • 2020-10-10
      • 2021-06-17
      • 2020-11-02
      • 2021-01-12
      • 2020-10-25
      • 2021-08-07
      • 2016-10-27
      • 1970-01-01
      • 2016-03-13
      相关资源
      最近更新 更多