mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2025-10-07 07:22:37 +02:00
73 lines
1.9 KiB
JavaScript
73 lines
1.9 KiB
JavaScript
const path = require('path');
|
|
const webpack = require('webpack');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
|
|
entry: {
|
|
background: './src/scripts/background.js',
|
|
popup: './src/scripts/popup.js',
|
|
options: './src/scripts/options.js',
|
|
styles: ['./src/styles/popup.scss', './src/styles/options.scss'],
|
|
},
|
|
|
|
output: {
|
|
filename: '[name].[chunkhash].js',
|
|
path: path.resolve(__dirname, 'extension'),
|
|
},
|
|
|
|
plugins: [new webpack.ProgressPlugin(), new HtmlWebpackPlugin()],
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /.(js|jsx)$/,
|
|
include: [path.resolve(__dirname, 'src/scripts')],
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
plugins: ['syntax-dynamic-import'],
|
|
|
|
presets: [
|
|
[
|
|
'@babel/preset-env',
|
|
{
|
|
modules: false,
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
{
|
|
test: /\.scss$/,
|
|
use: [
|
|
{
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: '[name].css',
|
|
context: './src/styles/',
|
|
outputPath: 'css/',
|
|
},
|
|
},
|
|
'extract-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
sourceMap: true,
|
|
},
|
|
},
|
|
'resolve-url-loader',
|
|
'sass-loader',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
|
|
optimization: {},
|
|
|
|
devServer: {
|
|
open: true,
|
|
},
|
|
};
|