acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
648 stars 72 forks source link

'acorn' should be in dependencies in package.json, instead of devDependencies #94

Closed dashea closed 5 years ago

dashea commented 5 years ago

Since acorn is required from index.js, and acorn is not currently installed with NODE_ENV=production.

RReverser commented 5 years ago

No, acorn is a peer dependency, which means you need to install it yourself alongside acorn-jsx. You can't use acorn-jsx on its own without actual acorn.

worc commented 5 years ago

the issue is when you're installing another package that uses acorn... the dependency chain breaks down and acorn-jsx doesn't have its peer installed. i could install acorn, but in my repo's history there's no discernible reason why it was installed. we don't use acorn directly, but now we have to install it anyways?

it's a bad design and it isn't keeping with the way npm has changed over the years.

RReverser commented 5 years ago

Well yeah you need to use Acorn because it's the main parser while Acorn JSX is just a plugin called by it, so it's better to give control to manage versions of both explicitly on the caller side.

worc commented 5 years ago

i'm not on the "caller's side" though. acorn-jsx is a transitive dependency for me, so whatever i'm depending on is not explicitly installing acorn. but if acorn-jsx doesn't run without acorn it's not really optional, and peer dependencies no longer install by default. it seems like acorn is actually just a full dependency for acorn-jsx.