I attempted to use parcel to bundle a commonJS project.
For example
const assert = require('assert')
const MyWebComponent = require('./my-web-component')
async function main () {
const comp = new MyWebComponent()
assert(comp.tagName, 'is component')
document.body.appendChild(comp)
}
main()I tried compiling this with parcel
parcel build src/index.js -d src -o bundle.jsI was suprised that when running it complained about regenerator ( parcel-bundler/parcel#2128 ).
I was frustrated that parcel used babel to "compile" my async function when my browser support async/await.
I could not find a parcel --no-babel flag.
I did however find a parcel --target node --bundle-node-modules option.
This worked great until i got a runtime exception related to cannot find module assert.
My browser environment needs https://github.com/browserify/commonjs-assert to be bundled. I could not find any CLI flags that said polyfill builtin node modules.
I did find this documentation https://v2.parceljs.org/features/node-emulation/ but there was no CLI flag to turn node emulation on.