forked from bond-tech/bond-sdk-web
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
129 lines (122 loc) · 4.15 KB
/
webpack.dev.js
File metadata and controls
129 lines (122 loc) · 4.15 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const webpack = require("webpack");
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: {
"bond-sdk-web": [
path.resolve(__dirname, "./src/show.js"),
path.resolve(__dirname, "./src/collect.js"),
path.resolve(__dirname, "./src/bond-sdk-web.ts"),
],
'link-account': path.resolve(__dirname, './src/link-account.ts'),
'oauth-redirect': path.resolve(__dirname, './src/oauth-redirect.ts'),
'micro-deposit': path.resolve(__dirname, './src/micro-deposit.ts'),
'delete-account': path.resolve(__dirname, './src/delete-account.ts'),
index: path.resolve(__dirname, "./src/sample-card-show.ts"),
multiple: path.resolve(__dirname, "./src/sample-card-show-multiple.ts"),
pin: path.resolve(__dirname, "./src/sample-pin-setting.ts"),
copy: path.resolve(__dirname, "./src/sample-card-copy.ts"),
},
output: {
path: path.resolve(__dirname, "./dist"),
filename: "[name].js",
publicPath: "./",
library: "BondWeb",
libraryTarget: "umd",
globalObject: "this",
},
resolve: {
extensions: ['.ts', '.js']
},
// Enable sourcemaps for debugging webpack's output.
devtool: "source-map",
module: {
rules: [
// JavaScript
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader", "eslint-loader"],
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{ test: /\.tsx?$/, loader: "ts-loader" }
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
// { test: /\.js$/, loader: "source-map-loader" },
],
},
mode: "development",
devServer: {
historyApiFallback: true,
contentBase: path.resolve(__dirname, "./dist"),
publicPath: "/",
open: true,
compress: true,
hot: true,
port: 8080,
},
plugins: [
new webpack.EnvironmentPlugin(['IDENTITY','AUTHORIZATION']),
new CleanWebpackPlugin(),
// Only update what has changed on hot reload
new webpack.HotModuleReplacementPlugin(),
new CopyPlugin({
patterns: [
path.resolve(__dirname, "src", "sample.css"),
],
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "./src/sample_card_show.html"),
inject: true,
chunks: ["bond-sdk-web", "index"],
filename: "index.html", // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "./src/sample_card_show_multiple.html"),
inject: true,
chunks: ["bond-sdk-web", "multiple"],
filename: "sample_card_show_multiple.html", // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "./src/sample_pin_setting.html"),
inject: true,
chunks: ["bond-sdk-web", "pin"],
filename: "sample_pin_setting.html", // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "./src/sample_card_copy.html"),
inject: true,
chunks: ["bond-sdk-web", "copy"],
filename: "sample_card_copy.html", // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/link-account.html'),
inject: true,
chunks: ['bond-sdk-web', 'link-account'],
filename: 'link-account.html', // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/oauth-redirect.html'),
inject: true,
chunks: ['bond-sdk-web', 'oauth-redirect'],
filename: 'oauth-redirect.html', // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/micro-deposit.html'),
inject: true,
chunks: ['bond-sdk-web', 'micro-deposit'],
filename: 'micro-deposit.html', // output file
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/delete-account.html'),
inject: true,
chunks: ['bond-sdk-web', 'delete-account'],
filename: 'delete-account.html', // output file
}),
],
};