import { resolve } from 'path'; import { Configuration } from 'webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import CircularDependencyPlugin from 'circular-dependency-plugin'; const commonConfig: Configuration = { entry: './src/index.ts', module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ }, { test: /\.(png|svg|jpg|gif)$/, use: [ { loader: 'file-loader', options: { outputPath: 'assets/images' } } ], exclude: /node_modules/ }, { test: /\.(mp3|ogg|wav)$/, use: [ { loader: 'file-loader', options: { outputPath: 'assets/audio' } } ], exclude: /node_modules/ } ] }, resolve: { extensions: ['.tsx', '.ts', '.js'] }, output: { filename: 'bundle.js', path: resolve(__dirname, 'dist') }, plugins: [ new HtmlWebpackPlugin({ title: 'Entropy Game Engine', template: 'src/index.html', favicon: 'src/assets/images/favicon.ico' }), new CircularDependencyPlugin({ // exclude detection of files based on a RegExp exclude: /a\.js|node_modules/, // add errors to webpack instead of warnings failOnError: true, // allow import cycles that include an asyncronous import, // e.g. via import(/* webpackMode: "weak" */ './file.js') allowAsyncCycles: false, // set the current working directory for displaying module paths cwd: process.cwd() }) ] }; export default commonConfig;