This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.webext.js
65 lines (64 loc) · 1.64 KB
/
webpack.config.webext.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
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
// const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
module.exports = (env, options) => {
return {
entry: {
content: path.resolve(__dirname, 'src/main.js'),
background: path.resolve(__dirname, 'src/platform/webext/background.js')
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader'
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
}
]
},
resolve: {
alias: {
'platform/fetch': path.resolve(__dirname, 'src/platform/webext/fetch.js')
}
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin({
chunks: ['content'],
template: 'src/index.html'
}),
new CopyPlugin([
{from: 'image/dist/icon_32.png', to: 'icon_32.png'},
{from: 'image/dist/icon_48.png', to: 'icon_48.png'},
{from: 'image/dist/icon_96.png', to: 'icon_96.png'},
{from: 'manifest.json', to: 'manifest.json'},
]),
// new BundleAnalyzerPlugin()
]
}
};