Fork of webpack loader which evaluates the module at compile time


1.0.23 years ago3 years agoMinified + gzip package size for @htmlacademy/compile-loader in KB



Allows custom preprocessing by evaluating the module at compile time.

Useful for removing secrets from the source when bundling config files.


npm install compile-loader --save-dev


function PRIVATE(a) {
  return process.env.CLIENT ? a : undefined;
module.exports = {
  production: {
    port: 9000,
    assets: [],
    session: {
      secret: PRIVATE('eE79c5!637304*34eA0d5f5fbb,e3d1?')

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 bundle
module.exports = {"production":{"port":9000,"assets":[],"session":{}}}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.