Closed mvlabat closed 5 years ago
Please add a direct dependency.
Or, in other words: do not require
anything that is not in dependency or peerDependency. parcel-bundler
should actually be a peer (in addition to dev) dependency, but I will leave it up to you to change it in this PR or not.
Thanks for the comment! I actually agree with you on this. Didn't add it at first as it was the same for toml
, but I assume we could avoid this problem at all if it was added as a dependency from the beginning. Fixed
@ishitatsuyuki
Just had to rollback making parcel-bundler a peer dependency. It seems like it breaks my local project. Can we require
a peer dependency in the plugin code? I've never used peer dependencies, so I'm not really sure how they work.
Pardon me, rollback what? What's broken?
The dependency thing I mentioned is a coding practice, and even if you don't follow it the code will accidentally work due to NPM's flat install architecture. It can break later like this case, of course.
@mvlabat Thanks for the PR.
Should be better if we move the require('@iarna/toml')
under the this.isNormalTOML()
equals to true condition.
Then we can have our package.json without @iarna/toml
needed.
@catsigma No, that is not good. That's against the Node.js module resolution algorithm.
See https://pnpm.js.org/docs/en/faq.html#pnpm-does-not-work-with-your-project-here for some explanation.
@ishitatsuyuki, sorry that was my own mistake, disregard my last comment. Could someone else test it with https://github.com/rustwasm/rust-parcel-template as well? Updated plugin now works for me, but I would like somebody else to confirm it before merging.
Parcel switched from toml to @iarna/toml. So this update should fix #13