Hacker News new | ask | show | jobs
by devongovett 2351 days ago
You’re right, this is happening to some degree with Parcel. Our aim with Parcel 2 is to open up the plugin system to allow more extensibility while keeping it as simple as possible to use out of the box. This is accomplished through a very well defined plugin system with explicit extension points for each step of the build pipeline (not the Wild West of extensibility like other tools), and a good default configuration that you can extend or override as needed with a simple JSON config format. The result is that you get everything Parcel 1 could do and more out of the box, but you can easily change or extend Parcel 2 with more features specific to your app if you need to.

We’ve been working on Parcel 2 for almost 2 years now (~1 year in design, another in development) and I think it strikes a pretty good balance. I’m excited to see what the community does with it! :)

1 comments

Can the configuration have strong types (via TypeScript or similar) pretty pretty please? One of my main frustrations with webpack is the undocumented, unpredictable, unspecified config file format that seems to have no rhyme or reason, which you must often change with every new plugin you add.
Yep! I think we should be able to publish a JSON schema definition that editors like vscode can use to provide autocomplete etc.
That’s not strong typing, that’s automated (and not necessarily up to date) documentation :(
Is there another way to provide strong types for a JSON file?

I believe vscode uses schemas from http://schemastore.org/ for many config files already.

Yep, a schema would work fine for this (and you can generate it from types)

You can test them locally using vscode using the "$schema" field on the root obj, here's an example PR doing all that: https://github.com/danger/peril/pull/281

You can either have users add that schema reference in the JSON (throw it in the template) or ship a vscode extension which connects them

If you define the types in TS, you can use https://github.com/YousefED/typescript-json-schema to automatically generate a JSON schema from it. That way, configurations can be specified either in an executable JS module or in a JSON file.
Yep, we’ll definitely use a tool like that. We already have types in Flow for all of Parcel 2, so should be possible to do something similar.
It wasn't clear until now that the configuration is done through JSON rather than being configurable through code (i.e TypeScript).

Urgh, JSON for configuration. That's going to be horrible.

JSON is much more static and predictable for configuration. Config through a real programming language was a mistake that many tools made unfortunately. Static configuration has several nice properties including cacheability and simplicity that cannot be guaranteed in a full programming language. Just look at webpack.config.js for an example of the opposite.
I feel that pain, yeah. On the other hand, at least the error messages are often helpful with Webpack.