-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
53 lines (52 loc) · 1.56 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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const fs = require('fs');
module.exports = {
mode: "production",
entry: {
AtDocumentStart: "./webpack-resources/AtDocumentStart.js",
ReadabilityBasic: "./webpack-resources/ReadabilityBasic.js",
ReadabilitySanitized: "./webpack-resources/ReadabilitySanitized.js",
},
output: {
path: path.resolve(__dirname, 'Sources'),
filename: (pathData) => {
const chunkName = pathData.chunk.name;
if (chunkName === 'AtDocumentStart') {
return 'ReadabilityUI/Resources/[name].js';
} else {
return 'Readability/Resources/[name].js';
}
}
},
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
'raw-loader'
]
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './webpack-resources/Reader.html',
filename: 'ReadabilityUI/Resources/Reader.html',
inject: false,
templateParameters: {
css: fs.readFileSync('./webpack-resources/Reader.css', 'utf8')
},
minify: false
}),
new webpack.DefinePlugin({
__READABILITY_OPTIONS__: JSON.stringify({
debug: false,
maxElemsToParse: 0,
nbTopCandidates: 5
})
})
]
};