ifdef-loader icon indicating copy to clipboard operation
ifdef-loader copied to clipboard

ifdef-loader not reflecting in main.js

Open naveenakn7122 opened this issue 4 years ago • 0 comments

hi @nippur72 i installed ifdef-loader 2.3.0 to understand this package, but i see that its not really removing code in main.js , my changes below. logs during build clearly sharing message, but not reflecting main.js. can you please let me know what has went wrong here.

///// custom-webpack.config.js ///////

const opts = { myVal: 1, "ifdef-verbose": true, // add this for verbose output "ifdef-triple-slash": true, // add this to use double slash comment instead of default triple slash "ifdef-fill-with-blanks": true, // add this to remove code with blank spaces instead of "//" comments "ifdef-uncomment-prefix": "// #code " // add this to uncomment code starting with "// #code " }; module.exports = { module: { rules: [ { test: /.ts?$/, exclude: /node_modules/, use: [ { loader: "ts-loader" }, { loader: "ifdef-loader", options: opts } ] }, ] }

////// app.component.ts ///////

export class AppComponent { /// #if myVal==2 title: string = 'preprocessorexmple 1'; /// #endif /// #if myVal!=2 title1: string = 'preprocessorexmple '; /// #endif constructor() { } }

// verbose ng build ⠦ Generating browser application bundles (phase: building)...#if block lines [9-11]: Condition 'myVal==2' is FALSE. Excluding everything (src\app\app.component.ts) #if block lines [12-14]: Condition 'myVal!=2' is TRUE. Including lines [12-14] (src\app\app.component.ts)

///// main.js generated file ////// } } class AppComponent { /// #endif constructor() { /// #if myVal==2 this.title = 'preprocessorexmple 1'; /// #endif /// #if myVal!=2 this.title1 = 'preprocessorexmple '; } }

naveenakn7122 avatar Apr 24 '21 20:04 naveenakn7122