Iām having trouble with Parcel lately. When I try to run npm run build
in the plugin directory, the following error occurs:
šØ Kontext.vue:undefined:undefined: PostCSS plugin postcss-purgecss requires PostCSS 8.
Along with the error comes a link to the āMigration guideā that suggest updating to Parcel 2 nightly pre-release. But I donāt think thatās an option.
Thereās no error using npm run dev
.
When I remove the <style>
parts from the single file component, build
runs smoothly without errors.
Itās strange because the setup did work before on my machine without errors. I recently updated MacOS Big Sur to Version 11.3.1 but not sure if thatās connected to the error.
Iām really no expert on Parcel. For the plugin-setup I followed the instructions from the Cookbook. What I tried so far is removing the folders node_modules
and .cache
as well as the file package-lock.json
. I also re-installed Node, npm and Parcel globally without effect.
Hereās the package.json
file:
{
"scripts": {
"dev": "parcel watch src/index.js --no-source-maps -d ./",
"build": "parcel build src/index.js --no-source-maps --experimental-scope-hoisting -d ./"
},
"posthtml": {
"recognizeSelfClosing": true
},
"devDependencies": {
"@vue/component-compiler-utils": "^3.2.0",
"vue-template-compiler": "^2.6.13"
},
"dependencies": {
"vue": "^2.6.13",
"vue-hot-reload-api": "^2.3.4"
}
}
(The dependencies
are actually being added by npm run dev
)
Test fresh pluginkit
I also downloaded a fresh pluginkit ZIP-File from Plugin setup for Panel plugins | Kirby CMS and made a dry run with npm run build
.
Parcel fetches the dependencies and changes the package.json
to this:
{
"scripts": {
"dev": "parcel watch src/index.js --no-source-maps -d ./",
"build": "parcel build src/index.js --no-source-maps --experimental-scope-hoisting -d ./"
},
"posthtml": {
"recognizeSelfClosing": true
},
"devDependencies": {
"@vue/component-compiler-utils": "^3.2.0",
"cssnano": "^5.0.5",
"postcss": "^8.3.0",
"sass": "^1.34.1",
"vue-template-compiler": "^2.6.13"
}
}
Now thereās a slightly different but closely related error:
šØ PostCSS plugin postcss-discard-comments requires PostCSS 8.
Again, when I remove the (still empty) <style>
part from the single file component, thereās no error on build
. And of course npm run dev
just works anyhow.