-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.docs.js
33 lines (32 loc) · 975 Bytes
/
webpack.docs.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
const path = require('path');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const commonConfig = require('./webpack.common');
module.exports = (env, options) => {
const config = commonConfig(env, options);
const tsLoaderRule = config.module.rules.find(r => r.loader === 'ts-loader');
tsLoaderRule.options.configFile = 'src/docs/tsconfig.json';
return {
...config,
mode: 'development',
entry: path.resolve(__dirname, 'src/docs/index'),
output: {
path: path.resolve(__dirname, './docs'),
filename: 'index.js',
},
plugins: config.plugins.concat([
new HtmlWebPackPlugin({
template: './src/docs/index.html',
filename: './index.html',
// Append a unique webpack compilation hash to all included scripts and CSS
hash: true,
})
]),
devServer: {
static: {
directory: path.join(__dirname, 'docs'),
},
compress: true,
port: 8080,
},
};
};