-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.common.js
85 lines (78 loc) · 2.02 KB
/
webpack.common.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const yaml = require('js-yaml');
const OUTPUT_FOLDER = 'docs';
module.exports = {
entry: {
main: './src/index.ts',
settings: './src/settings.ts',
discussion_ui: './src/discussion-ui.ts',
ongoing_or_paused: './src/popups/ongoing_or_paused.ts'
},
output: {
filename: '[name].[fullhash].js',
path: path.resolve(__dirname, OUTPUT_FOLDER)
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.([tj])s$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Lean Coffee Trello Power-up',
template: '_index.html',
filename: 'index.html',
chunks: ['main']
}),
new HtmlWebpackPlugin({
title: 'Lean Coffee Settings',
template: '_settings.html',
filename: 'settings.html',
chunks: ['settings']
}),
new HtmlWebpackPlugin({
title: 'Discussion UI',
template: '_discussion-ui.html',
filename: 'discussion-ui.html',
chunks: ['discussion_ui']
}),
new HtmlWebpackPlugin({
title: 'Ongoing or paused',
template: '_ongoing_or_paused.html',
filename: 'ongoing_or_paused.html',
chunks: ['ongoing_or_paused']
}),
new CopyWebpackPlugin(
{
patterns: [
{
from: 'assets/**/*',
globOptions: {
ignore: process.env.NODE_ENV === 'production' ? [] : ['assets/listings/**/*']
}
},
{
from: 'i18n/*.yml',
to: 'i18n/[name].json',
transform: (content) => Buffer.from(
JSON.stringify(
yaml.load(content.toString('utf8'), { schema: yaml.JSON_SCHEMA })
),
'utf8'
)
},
{ from: '*.html', globOptions: { ignore: ['_*'] } }
]
}
)
]
};