-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
95 lines (94 loc) · 2.16 KB
/
webpack.config.js
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
90
91
92
93
94
95
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
module.exports = {
mode: 'production',
target: 'web',
context: `${__dirname}/src`,
entry: {
background: './background',
'content-script': './content-script',
popup: './popup',
},
output: {
path: `${__dirname}/dist/`,
filename: '[name].js',
publicPath: './',
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
},
},
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
{
loader: 'css-loader',
options: {
esModule: false,
},
},
'sass-loader',
],
},
{
test: /\.(css|jpg|gif|png|woff|woff2|eot|ttf)$/,
loader: 'file-loader',
options: {
name: 'assets/[name].[ext]',
},
},
{
test: /\.svg$/,
loader: 'svg-inline-loader',
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
'icon.png',
{
from: 'manifest.json',
transform: (content) => {
return Buffer.from(
JSON.stringify({
...JSON.parse(content.toString()),
name: process.env.npm_package_productName,
description: process.env.npm_package_description,
version: process.env.npm_package_version,
})
)
},
},
'content-script.css',
],
}),
new HtmlWebpackPlugin({
template: './popup.html',
filename: './popup.html',
chunks: ['popup'],
}),
new VueLoaderPlugin(),
new VuetifyLoaderPlugin(),
],
resolve: {
extensions: ['.js', '.ts', '.vue'],
alias: {
'~': `${__dirname}/src/`,
'~~': `${__dirname}/`,
vue$: 'vue/dist/vue.runtime.js',
},
},
}