Postcss in Parcel-bundler does not work; No CSS modules used

Viewed 1455

I am using Parcel-bundler@1.12.3, installed with npm.

My CSS is generic pure CSS with no modules or SASS or anything used.

The "parcel index.html" works perfectly.

However, when run "parcel build index.html --no-content-hash --out-dir public --no-cache --no-source-maps --public-url ./", parcel began to automatically install postcss and all the dependencies. Then throw this error.

I have tried to disable all my original CSS and use a dummy CSS for my index.html, the issue still persist.

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;
}

Error:

C:\Users...\frontend\styles\test.css:undefined:undefined: plugin is not a function at LazyResult.run (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:288:14) at LazyResult.asyncTick (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:212:26) at C:...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:254:14 at new Promise () at LazyResult.async (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:250:23) at LazyResult.then (C:\Users...\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:131:17)

Error msg in console

1 Answers

Faced the same problem and was able to solve it

I reinstalled postcss to version 8.2.7 in node_modules/parcel-bundler/

In my case

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

My style.scss file was built successfully

Related