webpack.config.js 666 B

123456789101112131415161718
  1. // eslint-disable-next-line no-unused-vars
  2. const webpack = require('webpack');
  3. const env = process.env.NODE_ENV;
  4. // eslint-disable-next-line import/no-dynamic-require
  5. const configFactory = require(`./.config/${env}`);
  6. // In some cases, npm env variables become rewritten to lower case names. To prevent this it is rewritten to the
  7. // original variable name so the --testPathPattern work in any case.
  8. if (process.env.npm_config_testpathpattern) {
  9. process.env.npm_config_testPathPattern = process.env.npm_config_testpathpattern;
  10. }
  11. module.exports = function() {
  12. return configFactory.create({
  13. testPathPattern: process.env.npm_config_testPathPattern,
  14. });
  15. };