This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
forked from MarkWattsBoomi/ui-component-signature-pad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
75 lines (71 loc) · 2.17 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const path = require('path');
const fs = require('fs');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WriteFilePlugin = require('write-file-webpack-plugin');
const flow = require('./package.json').flow;
module.exports = function() {
const config = {
entry: "./src/index.tsx",
output: {
filename: flow.filenames.js,
path: path.resolve(__dirname, 'build')
},
devtool: 'inline-source-map',
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
devServer: {
contentBase: './build'
},
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
use: [
{
loader: 'tslint-loader',
options: {
fix: true
}
}
]
},
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader"
},
{
test: /\.js$/,
enforce: "pre",
loader: "source-map-loader"
},
{
test:/\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
}
]
},
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
plugins: [
new WriteFilePlugin(),
new MiniCssExtractPlugin({ filename: flow.filenames.css })
],
}
if (!fs.existsSync('./build'))
fs.mkdirSync('./build');
let template = fs.readFileSync('./template.html').toString();
template = template
.replace('{{tenantId}}', flow.tenantId)
.replace('{{flowId}}', flow.id)
.replace('{{flowVersionId}}', flow.versionId)
fs.writeFileSync('./build/index.html', template);
return config;
};