2019-03-01 05:21:18 +00:00
|
|
|
const path = require('path');
|
2021-07-07 00:04:02 +00:00
|
|
|
const { merge } = require('webpack-merge');
|
2019-03-01 05:21:18 +00:00
|
|
|
|
2021-06-25 22:38:35 +00:00
|
|
|
const baseConfig = {
|
2019-03-01 05:21:18 +00:00
|
|
|
devtool: 'source-map',
|
2021-03-26 20:21:45 +00:00
|
|
|
mode: 'development',
|
2020-01-02 19:11:04 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
2020-10-17 23:53:33 +00:00
|
|
|
{
|
2022-05-10 13:52:06 +00:00
|
|
|
test: /\.tsx?$/i,
|
2020-10-17 23:53:33 +00:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'ts-loader'
|
|
|
|
},
|
|
|
|
],
|
|
|
|
exclude: /node_modules/,
|
2021-06-14 00:06:16 +00:00
|
|
|
},
|
2022-06-03 22:30:39 +00:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
import: false,
|
2022-06-04 18:08:18 +00:00
|
|
|
modules: {
|
|
|
|
localIdentName: '[path][name]__[local]',
|
|
|
|
}
|
2022-06-03 22:30:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
include: /\.module\.css$/
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
'style-loader',
|
|
|
|
'css-loader'
|
|
|
|
],
|
|
|
|
exclude: /\.module\.css$/
|
|
|
|
}
|
2020-01-02 19:11:04 +00:00
|
|
|
],
|
|
|
|
},
|
2021-07-07 00:04:02 +00:00
|
|
|
output: {
|
|
|
|
publicPath: 'dist/',
|
|
|
|
path: path.resolve('dist/'),
|
|
|
|
filename: '[name].bundle.js',
|
|
|
|
chunkFilename: '[name].bundle.js',
|
|
|
|
},
|
2020-10-17 23:53:33 +00:00
|
|
|
resolve: {
|
2022-05-10 13:52:06 +00:00
|
|
|
extensions: ['.ts', '.tsx', '.js'],
|
|
|
|
alias: {
|
|
|
|
js: path.resolve(__dirname, 'js/'),
|
|
|
|
json: path.resolve(__dirname, 'json/'),
|
|
|
|
}
|
2020-10-17 23:53:33 +00:00
|
|
|
},
|
2019-03-01 05:21:18 +00:00
|
|
|
};
|
2021-06-25 22:38:35 +00:00
|
|
|
|
2021-07-07 00:04:02 +00:00
|
|
|
const appConfig = merge(baseConfig,
|
2021-06-25 22:38:35 +00:00
|
|
|
{
|
|
|
|
entry: {
|
2021-12-22 18:37:21 +00:00
|
|
|
main2: path.resolve('js/entry2.ts'),
|
2022-05-10 13:52:06 +00:00
|
|
|
main2e: path.resolve('js/entry2e.ts'),
|
|
|
|
preact: path.resolve('js/entry.tsx'),
|
2021-06-25 22:38:35 +00:00
|
|
|
},
|
|
|
|
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/',
|
2021-06-25 22:38:35 +00:00
|
|
|
},
|
|
|
|
},
|
2021-07-07 00:04:02 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const workletConfig = merge(baseConfig,
|
2021-06-25 22:38:35 +00:00
|
|
|
{
|
|
|
|
target: false,
|
|
|
|
entry: {
|
|
|
|
audio_worker: path.resolve('js/ui/audio_worker.ts')
|
|
|
|
},
|
|
|
|
output: {
|
2021-07-07 00:04:02 +00:00
|
|
|
globalObject: 'globalThis',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
const workerConfig = merge(baseConfig,
|
|
|
|
{
|
|
|
|
target: false,
|
|
|
|
entry: {
|
|
|
|
format_worker: path.resolve('workers/format.worker.ts')
|
|
|
|
},
|
|
|
|
output: {
|
2021-06-25 22:38:35 +00:00
|
|
|
globalObject: 'globalThis',
|
|
|
|
},
|
|
|
|
},
|
2021-07-07 00:04:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
exports.default = [appConfig, workletConfig, workerConfig];
|