-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
36 lines (32 loc) · 1008 Bytes
/
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
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const fs = require('fs');
const markdownFileStringPlaceholderCN = fs.readFileSync(
path.resolve(__dirname, './doc/api.zh-CN.md')
).toString();
const markdownFileStringPlaceholderEN = fs.readFileSync(
path.resolve(__dirname, './doc/api.md')
).toString();
module.exports = {
mode: 'production',
entry: './doc/index.js',
output: {
path: path.resolve(__dirname, 'doc'),
filename: 'index.bundle.js'
},
devtool: 'source-map',
plugins: [
new HtmlWebpackPlugin({
title: 'API document',
hash: false,
filename: 'index.html',
template: path.resolve(__dirname, './doc/index.template.html'),
inject: 'body'
}),
new webpack.DefinePlugin({
markdownFileStringPlaceholderEN: JSON.stringify(markdownFileStringPlaceholderEN),
markdownFileStringPlaceholderCN: JSON.stringify(markdownFileStringPlaceholderCN)
})
],
};