This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbcp.webpack.config.js
65 lines (63 loc) · 1.9 KB
/
bcp.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
const CopyPlugin = require("copy-webpack-plugin");
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
extractComments: false,
terserOptions: {
output: { ascii_only: true },
},
})],
},
entry: {
background: ["regenerator-runtime/runtime.js", './src/assets/bc/js/background.js', ],
content: ["regenerator-runtime/runtime.js", './src/assets/bc/js/content.js'],
options: ["regenerator-runtime/runtime.js", './src/assets/bc/js/options.js', ],
},
output: {
filename: '[name]-bundle.js', // output bundle file name
path: path.resolve(__dirname, './build/bc/'),
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
plugins: ["@babel/plugin-proposal-class-properties"]
}
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jp?g|svg|gif)$/,
use: [{
loader: "file-loader",
options: { name: '[name].[ext]', outputPath: '/build/bc/img/', publicPath: '/static/img/' }
}]
}
]
},
plugins: [
new CopyPlugin({
patterns: [
{ from: "src/assets/bc/img", to: "img" },
{ from: "node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js",
to: "webcomponents-sd-ce.js" },
{ from: "src/assets/bc/manifest.json", to: "manifest.json" },
{ from: "src/assets/bc/options.html", to: "options.html" },
{ from: "src/data/static/data/css/transcrobes.css", to: "transcrobes.css" },
],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
};