Choose one: is this a 馃悰 bug report or 馃檵 feature request?
A question.
I'm writing a npm package, where I use the npm script to bundle the src files together into a single file. But I found the dist file doesn't bundle everything together, which causes this error:
/Users/changyan/Documents/repos/test/node_modules/react-animation-wrapper/lib/index.js:12:29: Cannot resolve dependency './emptyFunction'...
and when looking into the bundled file I noticed it's requiring something like this:
var e,r=require("./emptyFunction")
My npm script looks like this:
{
"build": "parcel build ./src/index.js --out-dir ./lib",
}
And I searched around on the internet but didn't find something useful to resolve my problem. Also, I read a post that addressed that rollup or webpack are probably better choices for writing npm packages. Is that true? Or am I using it wrong?
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |
| Node |
| npm/Yarn |
| Operating System |
I think your after https://github.com/developit/microbundle
Thanks @jamesmcallister , didn't know about this one!
related to #192 Seems like u found a solution with microbundle ;)
Having the same issue, what's wrong with using parcel-bundler for npm package bundling?
@eldyvoon it should be possible, just not 3 months ago
Sent with GitHawk
@DeMoorJasper or anyone else, so what I'm reading is that adding:
{
"build": "parcel build ./src/index.js --out-dir ./lib",
}
to one's package.json
would remove the need for would remove the need for rollup or microbundle
@djstein it looks parcel build --target node
was added in #652.
For libraries Microbundle is intended for building multiple outputs from the same input. In theory you get CJS, ESM, UMD, .min.js
, .d.ts
, etc. in one pass.
I don't think that's in scope for Parcel?
Interesting... but what about the TS typings files?
Looks like this might be in scope for Parcel 2?
@chocolateboy don't think so.
And still. Rollup HAS problems bundling everything and might be slow. Webpack is the only alternative, but cannot output ESM. There is @purtuga/esm-webpack-plugin, but it is a hack workaround just to make consuming easier. When third party is going to bundle to the generated package, the tree shaking won't work.
So. Yes we need more competition.
Most helpful comment
I think your after https://github.com/developit/microbundle