compile-loader
Allows custom preprocessing by evaluating the module at compile time.
Useful for removing secrets from the source when bundling config files.
Installation
npm install compile-loader --save-dev
Example
{ return processenvCLIENT ? a : undefined;}moduleexports = production: port: 9000 assets: session: secret: ;
Without the loader, calling PRIVATE
will not change the behavior of the
above code.
However, when using the eval-loader
, webpack will evaluate the module at
compile time and replace its contents with the resulting value of
module.exports
.
// resulting webpack bundlemoduleexports = "production":"port":9000"assets":"session":{}