add webpack to organize code

This commit is contained in:
Seth Burkart
2023-08-13 14:30:21 +10:00
parent 751c295b07
commit f285beaa44
21 changed files with 62 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
'SEQTA': './src/SEQTA.js',
'background': './src/background.js',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
include: path.resolve(__dirname, 'src'),
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
generator: {
filename: 'src/[path][name][ext]',
},
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'public', to: '.' }, // Copies everything from the public folder to the root level of build
{ from: 'src/inject', to: 'inject' },
],
}),
],
};