-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to specify the invocation options in the entry point JavaScript file #49
Comments
I can't comment on fastpack's current workflow as I haven't used it long enough to appreciate its ease of use or feel any pain. I can, however, describe what I wouldn't like and what I'd consider 'nice':
|
Yeah, config is better. At least package.json field. |
Ok, how about the same approach, but in the config file? |
Like this?
It doesn't look very friendly and I'm not sure it warrants bringing in a separate config layer. I'm contemplating with two approaches:
|
I like flow |
@rauanmayemir @TrySound thank you for your feedback! I, personally, don't see it as non-nice approach (in fact, we have seen it used in stack). Although, I see your points and from alternatives you've listed I like
That's definitely what we're trying to achieve with the block comment in the entry point, but the argument with code pollution is legitimate - no one likes the intrusive software. |
I'm removing the "first release" badge from this one. It seems it requires a little bit of a discussion before making the final decision. In the meantime we would recommend using shell files and provide some examples in the documentation. |
Problem
Currently, fastpack only allows to specify the configuration using the command line options interface. This works, but gets clunky very quickly, especially with several preprocessor options. Consider, for instance the command line required to pack the CRA-based application with fastpack:
As you can see, it quickly becomes unmaintainable as well as requires a lot additional quotation according to shell rules.
The obvious solution here is to add the config file. We would like to avoid it for the first release for a couple reasons:
cmdliner
for its "ease of use" and prefer config to be using it as much as possible.But still, we want to somehow improve the user experience when using fastpack.
Proposal
What if we allow to specify these invocation options in the entry point JavaScript file in a
pragma
-like comment. Here is and example above converted and included into thesrc/index.js
:And here is the invocation:
Couple things to note:
/* fastpack
and ends with*/
on the separate line--
are ignored--
and then follows usual command-line option format--preprocess=^src.+\.js$
vs--preprocess='^src.+\\.js$'
./dist
, not./src/dist
.This design also enables us to easily differentiate between development and production builds, permitting easier configuration and adding polyfills in the separate entry point file. For example:
index.js
index.prod.js
The text was updated successfully, but these errors were encountered: