const webpack = require('webpack'); const path = require('path'); const CopyWebpackPlugin = require("copy-webpack-plugin"); const buildMode = 'production'; // const buildMode = 'development'; // const TARGET = 'electron'; // const TARGET = 'webOS'; const TARGET = 'tizenOS'; module.exports = [ { mode: buildMode, entry: { preload: './src/main/Preload.ts', renderer: './src/main/Renderer.ts', }, target: 'web', module: { rules: [ { test: /\.tsx?$/, include: [path.resolve(__dirname, '../common/web'), path.resolve(__dirname, 'src')], use: [{ loader: 'ts-loader' }] } ], }, resolve: { alias: { 'src': path.resolve(__dirname, 'src'), 'modules': path.resolve(__dirname, 'node_modules'), 'common': path.resolve(__dirname, '../common/web'), }, extensions: ['.tsx', '.ts', '.js'], }, output: { filename: '[name].js', // NOTE: `dist/main` seems to be a reserved directory on the LGTV device??? Access denied errors otherwise when reading from main directory... path: path.resolve(__dirname, 'dist/main_window'), }, plugins: [ new CopyWebpackPlugin({ patterns: [ // Common assets { from: '../common/assets/**', to: '../[path][name][ext]', context: path.resolve(__dirname, '..', 'common'), globOptions: { ignore: ['**/*.txt'] } }, { from: '../common/web/main/common.css', to: '[name][ext]', }, // Target assets { from: 'assets/icons/largeIcon.png', to: '../../FCastReceiver/icon.png' }, { from: 'assets/icons/largeIcon.png', to: '../../FCastReceiverService/shared/res/icon.png' }, { from: '**', to: '../assets/[path][name][ext]', context: path.resolve(__dirname, 'assets'), }, { from: './src/main/*', to: '[name][ext]', globOptions: { ignore: ['**/*.ts'] } } ], }), new webpack.DefinePlugin({ TARGET: JSON.stringify(TARGET) }) ] }, { mode: buildMode, entry: { preload: './src/player/Preload.ts', renderer: './src/player/Renderer.ts', }, target: 'web', module: { rules: [ { test: /\.tsx?$/, include: [path.resolve(__dirname, '../common/web'), path.resolve(__dirname, 'src')], use: [{ loader: 'ts-loader' }] } ], }, resolve: { alias: { 'src': path.resolve(__dirname, 'src'), 'modules': path.resolve(__dirname, 'node_modules'), 'common': path.resolve(__dirname, '../common/web'), }, extensions: ['.tsx', '.ts', '.js'], }, output: { filename: '[name].js', path: path.resolve(__dirname, 'dist/player'), }, 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) }) ] }, ];