-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
- [ X] build
- [ X] serve
Is this a regression?
No. We are migrating from older versions to use Angular 7 cli project for first time
Description
We have written a custom webpack loader for our requirements which needs to be run on index.html file. To extend webpack configuration, we used below npm module -
https://github.com/meltedspark/angular-builders
We updated the angular.json file as per documentation of above module.
We were able to successfully use this module to extend webpack config but observed that our loader was run for all html files within project except index.html. Here is our custom webpack config that we used alongside the module -
const path = require('path');
module.exports = {
module: {
rules: [{
test: /\.html/,
use: [
'<custom-loader>'
]
}]
}While debugging, we found that index.html is handled separately using IndexHTMLWebpackPlugin by CLI which we assume might be the cause of this behavior.
Why we need custom loader?
We have a large website developed in a federated model and maintained by many teams across different geographic locations. To maintain consistency across all pages for Header/Footer content we have developed it separately as a Preact application. We use this Webpack loader to update index.html with HTML/JS/CSS of our application.
We are using Index.html to inject the code to keep Preact application out of Angular context.
@alan-agius4 I had discussed this with @mgechev during Angular conference last week and he suggested me to file a bug and reach out to you