2025-06-22 14:20:38 +05:00
|
|
|
const path = require('path');
|
|
|
|
|
const { merge } = require('webpack-merge');
|
|
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
|
const common = require('./webpack.common.js');
|
2023-04-13 19:12:22 +02:00
|
|
|
|
|
|
|
|
const appConfig = {
|
2025-06-22 14:20:38 +05:00
|
|
|
entry: './src/index.tsx',
|
2023-04-13 19:12:22 +02:00
|
|
|
output: {
|
2025-06-22 14:20:38 +05:00
|
|
|
path: path.resolve(__dirname, 'build'),
|
|
|
|
|
filename: 'static/js/app.bundle.js',
|
2023-04-13 19:12:22 +02:00
|
|
|
},
|
2023-04-13 21:44:54 +02:00
|
|
|
plugins: [
|
|
|
|
|
new HtmlWebpackPlugin({
|
2025-06-22 14:20:38 +05:00
|
|
|
template: './public/index.html',
|
|
|
|
|
filename: 'index.html',
|
|
|
|
|
inject: 'body',
|
2023-04-13 21:44:54 +02:00
|
|
|
}),
|
|
|
|
|
],
|
2023-04-13 19:12:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const backgroundConfig = {
|
2025-06-22 14:20:38 +05:00
|
|
|
entry: './src/background/background.ts',
|
2023-04-13 19:12:22 +02:00
|
|
|
output: {
|
2025-06-22 14:20:38 +05:00
|
|
|
path: path.resolve(__dirname, 'build/static/js'),
|
|
|
|
|
filename: 'background.bundle.js',
|
2023-04-13 19:12:22 +02:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const contentConfig = {
|
2025-06-22 14:20:38 +05:00
|
|
|
entry: './src/content/content.ts',
|
2023-04-13 19:12:22 +02:00
|
|
|
output: {
|
2025-06-22 14:20:38 +05:00
|
|
|
path: path.resolve(__dirname, 'build/static/js'),
|
|
|
|
|
filename: 'content.bundle.js',
|
2023-04-13 19:12:22 +02:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-22 05:08:57 +04:00
|
|
|
const injectConfig = {
|
2025-06-22 14:20:38 +05:00
|
|
|
entry: './src/content/inject.ts',
|
2023-04-22 05:08:57 +04:00
|
|
|
output: {
|
2025-06-22 14:20:38 +05:00
|
|
|
path: path.resolve(__dirname, 'build/static/js'),
|
|
|
|
|
filename: 'inject.bundle.js',
|
2023-04-22 05:08:57 +04:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-13 21:44:54 +02:00
|
|
|
const copyConfig = {
|
|
|
|
|
plugins: [
|
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
|
patterns: [
|
2025-06-22 14:20:38 +05:00
|
|
|
{ from: 'public/images', to: 'images' },
|
|
|
|
|
{ from: 'public/manifest.json', to: 'manifest.json' },
|
|
|
|
|
{ from: 'public/robots.txt', to: 'robots.txt' },
|
2023-04-13 21:44:54 +02:00
|
|
|
],
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-22 14:20:38 +05:00
|
|
|
module.exports = [merge(common, appConfig, copyConfig), merge(common, backgroundConfig), merge(common, contentConfig), merge(common, injectConfig)];
|