Skip to content
Snippets Groups Projects
Select Git revision
  • 529a0a91303c48f2863b7816218d66816f6bc1c6
  • main default
  • 35-cgu
  • 34-peertube-support
  • 27-add-autoplay-to-iframe
  • 33-bug-on-youtube-embed-urls
  • RC-Rekall-v1.1-fix_lpo
  • tuleap-140-go-back-to-my-capsules-page-when-i-m-on-capsule-preview-page
  • RC-Rekall-v1.2-fix10
  • RC-Rekall-v1.2-fix9
  • RC-Rekall-v1.2-fix8
  • RC-Rekall-v1.2-fix7
  • RC-Rekall-v1.2-fix6
  • RC-Rekall-v1.2-fix5
  • RC-Rekall-v1.2-fix4
  • RC-Rekall-v1.2-fix3
  • RC-Rekall-v1.2-fix2
  • RC-Rekall-v1.2-fix1
  • RC-Rekall-v1.1-fix-3
  • RC-Rekall-v1.1-fix-2
  • RC-Rekall-v1.1-fix-1
  • RC-Rekall-v1.1-delivered
  • preprod20220209-1535
23 results

FallbackController.php

Blame
  • webpack.config.js 2.14 KiB
    const path = require('path');
    const webpack = require('webpack');
    const TerserPlugin = require('terser-webpack-plugin');
    const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
    const paths = require('./config/paths');
    
    /** */
    const baseConfig = mode => ({
      entry: ['./src/polyfills.js', './src/index.js'],
      module: {
        rules: [
          {
            include: paths.appPath, // CRL
            loader: require.resolve('babel-loader'),
            options: {
              // Save disk space when time isn't as important
              cacheCompression: true,
              cacheDirectory: true,
              compact: true,
              envName: mode,
            },
            test: /\.(js|mjs|jsx)$/,
          },
          {
            test: /\.css$/i,
            use: ['style-loader', 'css-loader'],
          },
        ],
      },
      optimization: {
        minimizer: [
          new TerserPlugin({
            extractComments: true,
            sourceMap: true,
          }),
        ],
      },
      output: {
        filename: 'mirador.min.js',
        library: 'Mirador',
        libraryExport: 'default',
        libraryTarget: 'umd',
        path: path.join(__dirname, 'dist'),
        publicPath: '/dist/',
      },
      plugins: [
        new webpack.IgnorePlugin({
          resourceRegExp: /@blueprintjs\/(core|icons)/, // ignore optional UI framework dependencies
        }),
      ],
      resolve: {
        alias: {
          // needs shared global state for context to work
          'react-dnd': path.resolve(path.join(__dirname, 'node_modules', 'react-dnd')),
        },
        extensions: ['.js'],
      },
    });
    
    module.exports = (env, options) => {
      const isProduction = options.mode === 'production';
      const config = baseConfig(options.mode);
    
      if (isProduction) {
        return {
          ...config,
          devtool: 'source-map',
          mode: 'production',
          plugins: [
            ...(config.plugins || []),
            new webpack.optimize.LimitChunkCountPlugin({
              maxChunks: 1,
            }),
          ],
        };
      }
    
      return {
        ...config,
        devServer: {
          contentBase: './__tests__/integration/mirador',
          hot: true,
          port: 4444,
        },
        devtool: 'eval-source-map',
        mode: 'development',
        plugins: [
          ...(config.plugins || []),
          new ReactRefreshWebpackPlugin(),
        ],
      };
    };