Skip to content
Snippets Groups Projects
config-overrides.js 1.83 KiB
Newer Older
const path = require('path');
chris's avatar
chris committed
module.exports = function override(config, env) {
  config.resolve = {
    symlinks: true,
  };

  if (process.env.NODE_ENV !== 'production') {
    config.resolve.alias = {
      'wax-prosemirror-core': path.resolve(
        __dirname,
        '../../wax-prosemirror-core/index',
      ),
      'wax-prosemirror-services': path.resolve(
        __dirname,
        '../../wax-prosemirror-services/index',
      ),
chris's avatar
chris committed
      'wax-questions-service': path.resolve(
        __dirname,
        '../../wax-questions-service/index',
      ),
chris's avatar
chris committed
      'wax-table-service': path.resolve(
        __dirname,
        '../../wax-table-service/index',
      ),
chris's avatar
chris committed
  config.module = {
    rules: [
      {
        oneOf: [
          {
            test: /\.js$/,
            loader: 'babel-loader',
chris's avatar
chris committed
            exclude: /node_modules/,
            options: {
              presets: [
                [require('@babel/preset-env'), { modules: false }],
                require('@babel/preset-react'),
chris's avatar
chris committed
              ],
              plugins: [
                ['@babel/plugin-proposal-decorators', { legacy: true }],
                'babel-plugin-parameter-decorator',
                ['@babel/plugin-proposal-class-properties', { loose: true }],
              ],
            },
chris's avatar
chris committed
          },
          {
            test: /\.css$/,
            use: ['style-loader', 'css-loader'],
chris's avatar
chris committed
          },
          {
            test: /\.svg$/,
            use: 'svg-inline-loader',
chris's avatar
chris committed
          },
          {
            test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
            use: [
              {
                loader: 'file-loader',
chris's avatar
chris committed
                options: {
                  name: '[name].[ext]',
                  outputPath: 'fonts/',
                },
              },
            ],
          },
        ],
      },
    ],
chris's avatar
chris committed
  };
  return config;
};