-
Notifications
You must be signed in to change notification settings - Fork 12k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose Webpack Configuration #20731
Comments
Cc. @kyliau |
Hi @yjaaidi, Any reason why not use the architect API to build the application?, Example: angular-cli/packages/angular_devkit/build_angular/src/protractor/index.ts Lines 107 to 108 in b34ed5c
I think realistically exposing the entire Webpack configuration will not be ideal. Here are some reasons.
|
Hey @alan-agius4, thanks for this 鈿★笍 lightning-fast feedback 鈿★笍. The main reason for this situation is that the way cypress component testing works is using all spec files as entry points that it lazy loads one by one depending on the tests you want to run. Here is the I can only see 3 options:
Am I missing any better option? Concerning the first option, I don't think that the function has to be part of the public API. It should be used with the following condition: the webpack configuration returned by the function will only be compatible with the exact same version defined here https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/package.json The main purpose of this function is to provide an easy way of hacking the configuration for extreme use cases like this one. In general, I'd rather use a "use at y傻ur 傻wn risk" piece of API than mimic the webpack config as it seems to be the only option. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi, I work on component testing at Cypress. Happy to answer any questions or do any work that might help move this forward. Ideally I'd like to test my Angular components with Cypress using the exact same configuration used by Angular CLI (via Sometimes it's easy, like with CRA. On the other hand, much like Angular, Next.js's webpack config is dynamic and changes a lot, and not officially "public" (eg, it's not documented) so it's "use at your own risk". I think something similar might work for Angular. |
This comment has been minimized.
This comment has been minimized.
I work on the Angular integration for bit.dev and we need the same thing, being able to programmatically run the angular dev server (which means that we can't really use the CLI and builders). |
For those who are interested, we (@jscutlery) managed to hack our way like this: We could expose this function through a library if lots of people show interest. It's not perfect but IMHO, it's way better than writing and maintaining an Angular webpack config from scratch. As mentioned here jscutlery/devkit#51, we are planning to add a 馃檹 special thanks to @alan-agius4 for your help! |
Nice job! This seems like a good enough work around for now - definitely better than maintaining a separately and fairly complex webpack config. I think a lot of people would appreciate a little helper library they can use for this! Just need to make sure there is a disclaimer that this uses undocumented internals, etc. |
Hi all, Thanks for all your input. We have discussed this issue in depth during yesterday team meeting and we feel that exposing the Webpack configuration is something that we don't want and want to keep this as private as possible. There are a number of reasons why we think that exposing the webpack config is not a good idea, below are some of these;
Therefore we feel that;
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
馃殌 Feature request
Description
In order to integrate Angular with some external tooling like Cypress Component Testing, it is necessary to provide a webpack (or any other building tool) configuration.
While
AngularCompilerPlugin
is a really good start, it doesn't cover the whole magic happening under the hood of@angular-devkit/build-angular
. This needs us to create a custom webpack config using theAngularCompilerPlugin
.Describe the solution you'd like
Even though Webpack is kind of an Angular implementation detail, it would be a dream come true to expose a function like
傻resolveWebpackConfig({target: 'my-app'})
that could be inspired from:angular-cli/packages/angular_devkit/build_angular/src/dev-server/index.ts
Lines 99 to 104 in f6135a2
I understand that this would considerably extend the public API's surface and that is why I am totally alright if we could start some experiments with a non-public function (hence the
傻
).https://github.com/jscutlery/test-utils/blob/ec422695e9de3ecfa560143098bda6198756e860/packages/cypress-mount-integration/src/plugins/index.js#L6-L40
Describe alternatives you've considered
Creating a public library exposing a webpack config that mimics
@angular-devkit/build-angular
behavior.If you are OK with the idea, I'd be happy to help.
The text was updated successfully, but these errors were encountered: