UNPKG

browser-plugin-creator

Version:

A modern scaffolding tool for creating browser extensions with ease

57 lines (56 loc) 1.33 kB
const path = require('path'); const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); module.exports = { entry: { popup: './src/popup/popup.js', background: './src/background.js', content: './src/content.js' }, output: { path: path.resolve(__dirname, 'dist'), filename: '[name].js', clean: true }, module: { rules: [ { test: /\.css$/i, use: [MiniCssExtractPlugin.loader, 'css-loader'] }, { test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset/resource', generator: { filename: 'images/[name][ext]' } } ] }, plugins: [ new CopyPlugin({ patterns: [ { from: 'manifest.json', to: 'manifest.json' }, { from: 'icons', to: 'icons', noErrorOnMissing: true } ] }), new HtmlWebpackPlugin({ template: './src/popup/popup.html', filename: 'popup.html', chunks: ['popup'] }), new MiniCssExtractPlugin({ filename: '[name].css' }) ], devServer: { static: { directory: path.join(__dirname, 'dist') }, compress: true, port: 9000, open: false }, mode: process.env.NODE_ENV || 'development' };