shakacode/bootstrap-loader

Weired behaviour of getEnvProps - Could not find 'styleLoaders' in your config

yahyaensi opened this issue · 2 comments

I use the version 2.1.0 of bootstrap-loader but i tried also 3.0.4.

bootstrap-loader doesn't find styleLoaders in .bootsraprc.

I tried to debug bootstrap-loader's getEnvProps method by adding console.log to it like following:

exports.default = function (prop, config) {
  if (prop in config) {
    return config[prop];
  }
  var NODE_ENV = process.env.NODE_ENV;
  var configEnvSection = config.env && config.env[NODE_ENV];
  console.log(NODE_ENV);
  console.log(config.env);
  console.log(config.env[NODE_ENV]);
  if (configEnvSection && prop in configEnvSection) {
    return configEnvSection[prop];
  }
  return false;
};

Then i get the following output:

development
{ development:
   { loglevel: 'debug',
     styleLoaders:
      [ 'style-loader?sourceMap',
        'css-loader?sourceMap&importLoaders=2',
        'sass-loader?sourceMap&outputStyle=expanded' ],
     extractStyles: false },
  production:
   { styleLoaders: [ 'css-loader?importLoaders=1', 'sass-loader?sourceMap' ],
     extractStyles: true } }
undefined

This instruction config.env[NODE_ENV] returns undefined.

See #359.

I close this issue. Please comment if it is still relevant.