babel.js 527 B

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