2019-02-28 21:21:18 -08:00
|
|
|
const path = require('path');
|
2021-07-06 17:04:02 -07:00
|
|
|
const { merge } = require('webpack-merge');
|
2019-02-28 21:21:18 -08:00
|
|
|
|
2021-06-25 15:38:35 -07:00
|
|
|
const baseConfig = {
|
2019-02-28 21:21:18 -08:00
|
|
|
devtool: 'source-map',
|
2021-03-26 21:21:45 +01:00
|
|
|
mode: 'development',
|
2020-01-02 11:11:04 -08:00
|
|
|
module: {
|
|
|
|
rules: [
|
2020-10-18 01:53:33 +02:00
|
|
|
{
|
|
|
|
test: /\.ts$/i,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'ts-loader'
|
|
|
|
},
|
|
|
|
],
|
|
|
|
exclude: /node_modules/,
|
2021-06-13 17:06:16 -07:00
|
|
|
},
|
2020-01-02 11:11:04 -08:00
|
|
|
],
|
|
|
|
},
|
2021-07-06 17:04:02 -07:00
|
|
|
output: {
|
|
|
|
publicPath: 'dist/',
|
|
|
|
path: path.resolve('dist/'),
|
|
|
|
filename: '[name].bundle.js',
|
|
|
|
chunkFilename: '[name].bundle.js',
|
|
|
|
},
|
2020-10-18 01:53:33 +02:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
2019-02-28 21:21:18 -08:00
|
|
|
};
|
2021-06-25 15:38:35 -07:00
|
|
|
|
2021-07-06 17:04:02 -07:00
|
|
|
const appConfig = merge(baseConfig,
|
2021-06-25 15:38:35 -07:00
|
|
|
{
|
|
|
|
entry: {
|
|
|
|
main2: path.resolve('js/entry2.js'),
|
|
|
|
main2e: path.resolve('js/entry2e.js')
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
library: {
|
|
|
|
name: 'Apple2',
|
|
|
|
type: 'umd',
|
|
|
|
export: 'Apple2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
compress: true,
|
|
|
|
static: {
|
|
|
|
watch: {
|
|
|
|
ignored: /(node_modules|test|\.git)/
|
|
|
|
},
|
|
|
|
directory: __dirname,
|
|
|
|
},
|
2021-07-04 08:12:12 -07:00
|
|
|
devMiddleware: {
|
2021-07-08 08:15:55 -07:00
|
|
|
publicPath: '/dist/',
|
2021-06-25 15:38:35 -07:00
|
|
|
},
|
|
|
|
},
|
2021-07-06 17:04:02 -07:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const workletConfig = merge(baseConfig,
|
2021-06-25 15:38:35 -07:00
|
|
|
{
|
|
|
|
target: false,
|
|
|
|
entry: {
|
|
|
|
audio_worker: path.resolve('js/ui/audio_worker.ts')
|
|
|
|
},
|
|
|
|
output: {
|
2021-07-06 17:04:02 -07:00
|
|
|
globalObject: 'globalThis',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const workerConfig = merge(baseConfig,
|
|
|
|
{
|
|
|
|
target: false,
|
|
|
|
entry: {
|
|
|
|
format_worker: path.resolve('workers/format.worker.ts')
|
|
|
|
},
|
|
|
|
output: {
|
2021-06-25 15:38:35 -07:00
|
|
|
globalObject: 'globalThis',
|
|
|
|
},
|
|
|
|
},
|
2021-07-06 17:04:02 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
exports.default = [appConfig, workletConfig, workerConfig];
|