Skip to content
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

Provide a way to configure targets outside package.json #5023

Open
jogold opened this issue Aug 14, 2020 · 3 comments
Open

Provide a way to configure targets outside package.json #5023

jogold opened this issue Aug 14, 2020 · 3 comments

Comments

@jogold
Copy link

jogold commented Aug 14, 2020

🙋 feature request

Parcel should provide a way to configure targets outside the package.json, either via the CLI (with v1 it was possible to pass all the configuration) or in another file.

🤔 Expected Behavior

Be able to fully configure a build without "touching" the package.json

😯 Current Behavior

Currently not possible

🔦 Context

Parcel is currently being used in the AWS CDK (AWS Cloud Development Kit) library to bundle Lambda functions written in JavaScript or Typesript.

The module @aws-cdk/aws-lambda-nodejs offers this feature.

It works by extracting/finding entries of Lambda functions defined in a stack and then automatically bundles them for the user when the AWS CDK app gets synthesized. Unfortunately, in order to offer this "it just works" experience we have to temporarily update the user's package.json with some Parcel configuration, run a Parcel build and then revert the file to its original content. This is not clean.

💻 Examples

$ parcel build /my/entry/file.ts --target-config target.json

OR (bring back CLI parameters when the entry file is specified)

$ parcel build /my/entry/file.ts --context node ...
@mischnic
Copy link
Member

targets outside the package.json,

This is possible from the API:

+targets?: ?(Array<string> | {+[string]: TargetDescriptor, ...}),

CLI parameters when the entry file is specified

You can specify entries on the CLI, you mean --context?

@jogold
Copy link
Author

jogold commented Aug 14, 2020

Ideally I would like to fully configure a target from the CLI (context, includeNodeModules, engines).

Also when developing with the API in TypeScript where can I find the definition files (.d.ts) for @parcel/core?

@mischnic
Copy link
Member

mischnic commented Aug 14, 2020

We use Flow for Parcel itself, so there are no TS definitons yet.

The plan is to create proper Flow libdefs and then convert them to TS at some point (#3912, #3720)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants