ifdef-loader | Webpack loader for JavaScript/TypeScript conditional | Parser library
kandi X-RAY | ifdef-loader Summary
kandi X-RAY | ifdef-loader Summary
Webpack loader for JavaScript/TypeScript conditional compilation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Find a module .
- foo bar
ifdef-loader Key Features
ifdef-loader Examples and Code Snippets
Community Discussions
Trending Discussions on ifdef-loader
QUESTION
I have an Ionic application that relies heavily on conditional compilation where I include or exclude blocks of code based on a set of config values similar to how m4 works.
I had been using https://github.com/nippur72/ifdef-loader successfully for this purpose.
I am now faced with upgrading this app from Angular 10 to 13 (Ionic 5 to 6).
ifdef-loader did not work out of the box with Angular 10 but a patch (https://gist.github.com/tristanidoux/892469f2c345bd6c6551eb19c705a016) to @angular-dev-kit allowed it to run.
This patch does not work with Angular 13 as all the files have changed and crawling through as much of the source as I can I don't yet see how to create a similar patch for Angular 13.
So I have been attempting to use "@angular-builders/custom-webpack": "^13.0.0" using https://medium.com/angular-in-depth/customizing-angular-cli-build-an-alternative-to-ng-eject-v2-c655768b48cc as a guide.
I have the following custom.webpack.config.js file modeled on the ifdef-loader documentation:
...ANSWER
Answered 2022-Jan-15 at 00:06After a week, I have been unable to determine how to insert a module into the typescript compilation pipeline in Angular's webpack implementation so I opted to create a patch for @angular-devkit/build-angular/@ngtools/webpack to call ifdef-loader directly.
Patch here: Angular Webpack Patch
It's ugly but it works.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ifdef-loader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page