-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
49 lines (47 loc) · 1.75 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
/* eslint-env node */
const path = require('path');
const WebpackUserscript = require('webpack-userscript');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const dev = process.env.NODE_ENV !== 'production';
module.exports = {
mode: dev ? 'development' : 'production',
entry: './src/main.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'live-translate.user.js',
},
module: {
rules: [
{
test: /\.jsx?$/,
use: 'babel-loader',
exclude: /^node_modules/,
},
],
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
},
plugins: [
new CleanWebpackPlugin(),
new WebpackUserscript({
headers: {
name: 'Live Translate' + (dev ? ' Dev' : ''),
version: dev ? '[version]-build.[buildTime]' : '[version]',
author: 'u/BakuhatsuK',
description: 'Get streaming translation comments easily. '
+ 'Based on extension made by u/konokalahola',
namespace: 'youtube.com',
include: 'https://*.youtube.com/*',
'run-at': 'document-start',
supportURL: 'https://github.com/kebien6020/live-translate-userscript',
downloadURL: dev ? undefined : 'https://github.com/kebien6020/live-translate-userscript/raw/master/dist/live-translate.user.js',
updateURL: dev ? undefined : 'https://github.com/kebien6020/live-translate-userscript/raw/master/dist/live-translate.user.js',
},
proxyScript: {
enable: () => dev,
filename: 'proxy.user.js',
},
}),
],
};