reservations_display/webpack.config.js
Adam Goldsmith 652f78944a Only specify devServer options for first webpack config
This avoids `[webpack-dev-middleware] ConcurrentCompilationError`
issues when running `webpack serve`. However, it prevents running the
dev server for just the `wall-display` config (as it no longer has the
`/calendar` proxy route defined.
2022-12-10 11:25:49 -05:00

82 lines
1.5 KiB
JavaScript

const path = require('path');
const common = {
mode: 'development',
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.html$/i,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
},
],
},
devtool: 'source-map',
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
};
module.exports = [
{
...common,
name: 'default',
entry: './src/index.ts',
devServer: {
allowedHosts: 'all',
proxy: {
'/calendar': {
target: 'https://calendar.google.com',
changeOrigin: true,
},
},
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: ['ts-loader'],
},
...common.module.rules,
],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
},
{
...common,
name: 'wall-display',
entry: './src/wall-display.ts',
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: ['babel-loader', 'ts-loader'],
},
...common.module.rules,
],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle-wall-display.js',
},
},
];