Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parcel build error: plugin is not a function

Tags:

bundler

parcel

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

like image 248
Lee Jongseo Avatar asked Apr 13 '21 05:04

Lee Jongseo


People also ask

What is a parcel plugin?

Parcel plugins are NPM packages. This means they have a package.json which declares the version of Parcel they are compatible with, along with any dependencies they may have. They must also follow a naming system to ensure clarity. Usually, Parcel plugins are published to the NPM registry, or to an internal company registry (e.g. Artifactory).

Is parcel-bundler deprecated?

Problem solved: parcel-bundler is deprecated. Use 'parcel' not 'parcel-bundler' Show activity on this post. package.json If you have preset the scripts... Replace index.html to whatever file you want to build, but make sure it is the same type of file. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.

How modular is parcel?

Parcel is designed to be very modular. Parcel core itself is almost not specific to building JavaScript or web pages – all behavior is specified via plugins. There are specific plugin types for each phase of a build, so you can customize just about everything. Parcel configuration is specified in a .parcelrc file.

Does parcel-bundler still work in Vue 2?

Show activity on this post. 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.


2 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.

like image 167
railsfanatic Avatar answered Nov 11 '22 22:11

railsfanatic


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

like image 24
Lee Jongseo Avatar answered Nov 11 '22 21:11

Lee Jongseo