1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-06-24 21:25:23 +00:00
fcast/receivers/electron/webpack.config.js

155 lines
4.8 KiB
JavaScript
Raw Normal View History

2024-12-09 00:56:55 -06:00
const webpack = require('webpack');
2023-06-20 08:45:01 +02:00
const path = require('path');
2024-12-09 00:56:55 -06:00
const CopyWebpackPlugin = require("copy-webpack-plugin");
// const buildMode = 'production';
const buildMode = 'development';
const TARGET = 'electron';
// const TARGET = 'webOS';
// const TARGET = 'tizenOS';
2023-06-20 08:45:01 +02:00
2024-11-04 09:17:20 -06:00
module.exports = [
{
2024-12-09 00:56:55 -06:00
mode: buildMode,
2024-11-04 09:17:20 -06:00
entry: './src/App.ts',
target: 'electron-main',
module: {
rules: [
{
test: /\.tsx?$/,
2024-12-18 12:48:54 -06:00
include: [path.resolve(__dirname, '../common/web'), path.resolve(__dirname, 'src')],
2024-11-04 09:17:20 -06:00
use: [{ loader: 'ts-loader' }]
}
],
},
resolve: {
2024-12-09 00:56:55 -06:00
alias: {
'src': path.resolve(__dirname, 'src'),
'modules': path.resolve(__dirname, 'node_modules'),
'common': path.resolve(__dirname, '../common/web'),
},
2024-11-04 09:17:20 -06:00
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
2024-12-09 00:56:55 -06:00
plugins: [
new CopyWebpackPlugin({
patterns: [
// Common assets
{
from: '../common/assets/**',
to: './[path][name][ext]',
context: path.resolve(__dirname, '..', 'common'),
globOptions: { ignore: ['**/*.txt'] }
},
// Target assets
{
from: '**',
to: './assets/[path][name][ext]',
context: path.resolve(__dirname, 'assets'),
globOptions: { ignore: [] }
}
],
}),
new webpack.DefinePlugin({
TARGET: JSON.stringify(TARGET)
})
]
2023-06-20 08:45:01 +02:00
},
2024-11-04 09:17:20 -06:00
{
2024-12-09 00:56:55 -06:00
mode: buildMode,
2024-11-04 09:17:20 -06:00
entry: {
preload: './src/main/Preload.ts',
renderer: './src/main/Renderer.ts',
},
target: 'electron-renderer',
module: {
rules: [
{
test: /\.tsx?$/,
2024-12-18 12:48:54 -06:00
include: [path.resolve(__dirname, '../common/web'), path.resolve(__dirname, 'src')],
2024-11-04 09:17:20 -06:00
use: [{ loader: 'ts-loader' }]
}
],
},
resolve: {
2024-12-09 00:56:55 -06:00
alias: {
'src': path.resolve(__dirname, 'src'),
'modules': path.resolve(__dirname, 'node_modules'),
'common': path.resolve(__dirname, '../common/web'),
},
2024-11-04 09:17:20 -06:00
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist/main'),
},
2024-12-09 00:56:55 -06:00
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: '../common/web/main/common.css',
to: '[name][ext]',
},
{
from: './src/main/*',
to: '[name][ext]',
globOptions: { ignore: ['**/*.ts'] }
}
],
}),
new webpack.DefinePlugin({
TARGET: JSON.stringify(TARGET)
})
]
2023-06-20 08:45:01 +02:00
},
2024-11-04 09:17:20 -06:00
{
2024-12-09 00:56:55 -06:00
mode: buildMode,
2024-11-04 09:17:20 -06:00
entry: {
preload: './src/player/Preload.ts',
renderer: './src/player/Renderer.ts',
},
target: 'electron-renderer',
module: {
rules: [
{
test: /\.tsx?$/,
2024-12-18 12:48:54 -06:00
include: [path.resolve(__dirname, '../common/web'), path.resolve(__dirname, 'src')],
2024-11-04 09:17:20 -06:00
use: [{ loader: 'ts-loader' }]
}
],
},
resolve: {
2024-12-09 00:56:55 -06:00
alias: {
'src': path.resolve(__dirname, 'src'),
'modules': path.resolve(__dirname, 'node_modules'),
'common': path.resolve(__dirname, '../common/web'),
},
2024-11-04 09:17:20 -06:00
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist/player'),
},
2024-12-09 00:56:55 -06:00
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: '../common/web/player/common.css',
to: '[name][ext]',
},
{
from: './src/player/*',
to: '[name][ext]',
globOptions: { ignore: ['**/*.ts'] }
}
],
}),
new webpack.DefinePlugin({
TARGET: JSON.stringify(TARGET)
})
]
2024-11-04 09:17:20 -06:00
}
];