const path = require('path');

module.exports = {
  mode: 'development',  
  entry: './src/App.js',
  output: {
    path: path.resolve('dist'),
    filename: 'bundle.js',
    libraryTarget: 'umd',
    globalObject: 'this',
    library: 'MyReactPdfViewer',
  },
  module: {
    rules: [
        {
          test: /\.(js|jsx)$/,
          exclude: /node_modules/,
          use: 'babel-loader',
        },
        {
          test: /\.css$/,
          use: ['style-loader', 'css-loader'],
        },
        {
          test: /\.(svg)$/,
          use: [
            {
              loader: 'file-loader',
              options: {
                name: '[name].[ext]',
                outputPath: 'assets/', // This puts the SVG files in dist/assets/
              },
            },
          ],
        },
      ],
  },
  resolve: {
    extensions: ['.js', '.jsx'],
  },
  externals: {
    react: 'react',
    'react-dom': 'react-dom',
  },
};
