-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.cjs
89 lines (87 loc) · 1.89 KB
/
webpack.common.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')
const webpack = require('webpack')
//const HtmlPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const ESLintPlugin = require('eslint-webpack-plugin')
module.exports = {
entry: {
popup: './src/popup.ts',
options: './src/options.ts',
},
module: {
rules: [
{
test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/i,
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext][query]',
},
},
// {
// test: /\.ts?$/,
// use: 'ts-loader',
// exclude: /node_modules/,
// },
{
test: /\.(js|ts)x?$/,
use: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.(jpg|jpeg|png|eot|ttf|svg)$/,
type: 'asset/resource',
},
{
test: /\.(scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: () => [autoprefixer],
},
},
},
{
loader: 'sass-loader',
},
],
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve('dist'),
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'static' },
{ from: 'src/returns-plugin-production.js', to: 'returns-plugin-production.js' },
{ from: 'src/returns-plugin-staging.js', to: 'returns-plugin-staging.js' },
{ from: 'src/sherlock_script.js', to: 'sherlock_script.js' },
],
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
//Popper: ['popper.js', 'default'],
}),
new MiniCssExtractPlugin({
filename: 'styles/[name].css',
}),
new ESLintPlugin({
extensions: ['js', 'ts'],
fix: true,
overrideConfigFile: path.resolve(__dirname, '.eslintrc'),
}),
],
}