menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Parcel

📦🚀 Blazing fast, zero configuration web application bundler

Channels
Team

Parcel 2 plugin debugging with @parcel/logger

March 2, 2020 at 5:59am

Parcel 2 plugin debugging with @parcel/logger

March 2, 2020 at 5:59am
Can someone please provide some guidance on how to debug plugins?
console.log does not produce any output, logger.{info, verbose, error} do not produce either.
I attempt to log things like this:
const logger = new PluginLogger({origin: 'parcel-transformer-purgecss'})
logger.info({message: 'hello world'})
then when I build things:
import defaultConfig from '@parcel/config-default'
import {bundle} from '@parcel/test-utils' // NB: this is not published to NPM, I just `yarn link` it
await bundle(path.join(__dirname, '/fixture/index.html'), {
defaultConfig: {
...defaultConfig
},
filePath: require.resolve('@parcel/config-default'),
},
logLevel: 'verbose',
patchConsole: false,
})
But still no output is seen:
$ babel-node index.js
⠧ Building index.html...
✨ Built in 2.26s

March 2, 2020 at 6:01am
would really appreciate your help!
console.log should work, especially with patchConsole, I usually do parcel build .... | cat to prevent that the logs are overwritten by the progress indicator