parcel build error: plugin is not a function

Viewed 7280

I am trying to build a simple web project

project structure like this

-src
--index.html
--index.js
--style.css
package.json
yarn.lock

I installed parcel-bundler with this

yarn global add parcel-bundler

And I run the parcel build command

parcel build src/index.html

But error has occurred followed by this log

D:\playground\js\sample>parcel build src/index.html
×  D:\playground\js\sample\src\style.css:undefined:undefined: plugin is not a function
    at LazyResult.run (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:288:14)
    at LazyResult.asyncTick (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:212:26)
    at C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:254:14 
    at new Promise (<anonymous>)
    at LazyResult.async (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:250:23)
    at LazyResult.then (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:131:17)

I'm just following the instruction of parcel's official docs

I cannot find a solution

please help me

3 Answers

Try --no-minify

Why is the accepted answer, "throw out the baby with the bathwater?"

parcel-bundler does still work, but instead of fixing what's broken, it's been abandoned for Parcel 2, which DOES NOT support Vue 2 SFCs.

Building a Rails 6/Vue 2 app and converting to parcel from webpack(er), so Parcel 2 is not an option for me. (Demanding people upgrade, and then not providing an upgrade path or decent docs, reminds me too much of webpack!)

parcel build ./app/packs/entrypoints/*.js --no-minify

This disables minification, which at least eliminates this particular error for me.

Problem solved: parcel-bundler is deprecated. Use 'parcel' not 'parcel-bundler'

package.json If you have preset the scripts...

  "scripts": {
    "start": "parcel index.html",
    "dev": "parcel index.html",
    "build": "parcel build index.html"
  },

...simply run

npm run build

otherwise use this syntax:

npm run build index.html

Replace index.html to whatever file you want to build, but make sure it is the same type of file.

Related