babel.js 671 B

12345678910111213141516171819202122232425262728
  1. const { join, resolve } = require('path');
  2. const { env, settings } = require('../configuration');
  3. module.exports = {
  4. test: /\.(js|jsx|mjs|ts|tsx)$/,
  5. include: [
  6. settings.source_path,
  7. ...settings.resolved_paths,
  8. 'node_modules/@reduxjs'
  9. ].map(p => resolve(p)),
  10. exclude: function(modulePath) {
  11. return (
  12. /node_modules/.test(modulePath) &&
  13. !/@reduxjs/.test(modulePath)
  14. );
  15. },
  16. use: [
  17. {
  18. loader: 'babel-loader',
  19. options: {
  20. cacheDirectory: join(settings.cache_path, 'babel-loader'),
  21. cacheCompression: env.NODE_ENV === 'production',
  22. compact: env.NODE_ENV === 'production',
  23. },
  24. },
  25. ],
  26. };