-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
38 lines (36 loc) · 949 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
37
38
require('webpack');
const path = require('path');
const infos = require("./package.json");
const name = infos.name.replace(/^@flyingeek\//,"");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const config = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: `${name}.js`,
library: "pdfjs",
libraryTarget: "var"
},
module: {
rules: [
{
test: /pdf\.worker\.js/,
use: {
loader: 'worker-loader',
options: { inline: true, fallback: false }
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, './src/index.html'),
inject: "body",
inlineSource: '.(js|css)$',
filename: `${name}.html`,
}),
new HtmlWebpackInlineSourcePlugin(HtmlWebpackPlugin)
]
};
module.exports = config;