Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ifdef-loader not reflecting in main.js #50

Open
naveenakn7122 opened this issue Apr 24, 2021 · 0 comments
Open

ifdef-loader not reflecting in main.js #50

naveenakn7122 opened this issue Apr 24, 2021 · 0 comments

Comments

@naveenakn7122
Copy link

naveenakn7122 commented Apr 24, 2021

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 naveenakn7122 changed the title Use ifdef-loader not reflecting in main.js ifdef-loader not reflecting in main.js Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant