Configure webpack to handle both Angular and React components#173
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Configure webpack to handle both Angular and React components#173devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
- Add @angular-builders/custom-webpack to extend Angular CLI webpack - Add babel-loader rules for .jsx and .tsx files - Add react, react-dom and their type definitions - Enable JSX support in tsconfig.json - Update angular.json builders to use custom-webpack Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Configure webpack to handle both Angular and React components
Summary
Extends the Angular CLI webpack configuration using
@angular-builders/custom-webpackso the project can process both Angular and React component files. Adds babel-loader rules for.jsxand.tsxfiles alongside the existing Angular/TypeScript pipeline.Key changes:
webpack.config.js(new): Custom webpack rules usingbabel-loaderwith@babel/preset-reactand@babel/preset-typescriptfor.jsx/.tsxfilesangular.json: Swaps@angular-devkit/build-angularbuilders to@angular-builders/custom-webpackforbuildandservetargetstsconfig.json: Adds"jsx": "react"to compiler optionspackage.json: Addsreact@16,react-dom@16, Babel presets, types, and@angular-builders/custom-webpack@9The existing Angular build passes successfully with these changes.
Review & Testing Checklist for Human
package-lock.jsonwas generated whileyarn.lockalready exists. Verify which package manager the team uses and consider removing the other lockfile to avoid conflicts..jsx/.tsxReact files exist yet—create a sample React component and confirm it compiles and renders correctly within the Angular app to prove the config end-to-end.react@16andreact-dom@16were chosen for compatibility with Angular 9. Confirm this version aligns with team expectations.buildandservetargets use the custom-webpack builder;test,lint, ande2estill use@angular-devkit/build-angular. Verify this is acceptable or update if React files need to be covered by those targets.['.js', '.jsx', '.ts', '.tsx']toresolve.extensions. Confirmwebpack-mergecorrectly merges these with Angular CLI's defaults and doesn't drop anything (e.g.,.scss,.css).Suggested test plan: Create a minimal
.tsxReact component insrc/, import it from an Angular wrapper component, runng buildandng serve, and confirm no build errors and the component renders.Notes