apple2js/webpack.config.js

113 lines
2.7 KiB
JavaScript
Raw Normal View History

2019-03-01 05:21:18 +00:00
const path = require('path');
const { merge } = require('webpack-merge');
2019-03-01 05:21:18 +00:00
const baseConfig = {
2019-03-01 05:21:18 +00:00
devtool: 'source-map',
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/i,
use: [
{
loader: 'ts-loader'
},
],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
import: false,
2022-06-04 18:08:18 +00:00
modules: {
localIdentName: '[path][name]__[local]',
}
}
}
],
include: /\.module\.css$/
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
exclude: /\.module\.css$/
}
],
},
output: {
publicPath: 'dist/',
path: path.resolve('dist/'),
filename: '[name].bundle.js',
chunkFilename: '[name].bundle.js',
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
js: path.resolve(__dirname, 'js/'),
json: path.resolve(__dirname, 'json/'),
}
},
2019-03-01 05:21:18 +00:00
};
const appConfig = merge(baseConfig,
{
entry: {
main2: path.resolve('js/entry2.ts'),
main2e: path.resolve('js/entry2e.ts'),
preact: path.resolve('js/entry.tsx'),
},
output: {
library: {
name: 'Apple2',
type: 'umd',
export: 'Apple2',
},
},
devServer: {
compress: true,
static: {
watch: {
ignored: /(node_modules|test|\.git)/
},
directory: __dirname,
},
2021-07-04 15:12:12 +00:00
devMiddleware: {
2021-07-08 15:15:55 +00:00
publicPath: '/dist/',
},
},
}
);
const workletConfig = merge(baseConfig,
{
target: false,
entry: {
audio_worker: path.resolve('js/ui/audio_worker.ts')
},
output: {
globalObject: 'globalThis',
},
}
);
const workerConfig = merge(baseConfig,
{
target: false,
entry: {
format_worker: path.resolve('workers/format.worker.ts')
},
output: {
globalObject: 'globalThis',
},
},
);
exports.default = [appConfig, workletConfig, workerConfig];