about summary refs log tree commit diff
path: root/config/webpack/rules/babel.js
blob: 2fc245c432f6b93eb9b8890ccd7a92e4c81b0744 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { join, resolve } = require('path');
const { env, settings } = require('../configuration');

module.exports = {
  test: /\.(js|jsx|mjs)$/,
  include: [
    settings.source_path,
    ...settings.resolved_paths,
  ].map(p => resolve(p)),
  exclude: /node_modules/,
  use: [
    {
      loader: 'babel-loader',
      options: {
        cacheDirectory: join(settings.cache_path, 'babel-loader'),
        cacheCompression: env.NODE_ENV === 'production',
        compact: env.NODE_ENV === 'production',
      },
    },
  ],
};