-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
110 lines (98 loc) · 3.3 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
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
/*
Copyright (c) 2020 Academia Sinica, Institute of Information Science
License:
GPL 3.0 : The content of this file is subject to the terms and conditions
Project Name:
BiDae Object Tracker (BOT)
File Name:
webpack.config.js
File Description:
BOT UI component
Version:
1.0, 20200601
Abstract:
BeDIS uses LBeacons to deliver 3D coordinates and textual descriptions of
their locations to users' devices. Basically, a LBeacon is an inexpensive,
Bluetooth device. The 3D coordinates and location description of every
LBeacon are retrieved from BeDIS (Building/environment Data and Information
System) and stored locally during deployment and maintenance times. Once
initialized, each LBeacon broadcasts its coordinates and location
description to Bluetooth enabled user devices within its coverage area. It
also scans Bluetooth low-energy devices that advertise to announced their
presence and collect their Mac addresses.
Authors:
Tony Yeh, [email protected]
Wayne Kang, [email protected]
Edward Chen, [email protected]
Joe Chou, [email protected]
*/
const HtmlWebPackPlugin = require("html-webpack-plugin");
const webpack = require('webpack');
const dotenv = require('dotenv');
var path = require('path')
const env = dotenv.config().parsed;
const envKeys = Object.keys(env).reduce((prev, next) => {
prev[next] = JSON.stringify(env[next]);
return prev;
}, {});
module.exports = {
entry: './src/index.js',
mode: 'development',
output: {
path: path.join(__dirname, 'dist'),
filename: "bundle.js",
publicPath: '/',
},
module: {
rules: [
{
/**'/' 是 JS 正則表達式標記
* '.' 是正則表達式關鍵字,所以前面要加個 '\' 讓正則表達式以字元方式處理
* '|' 是 '或' 的意思
* '$' 是字串結束符號
* 整體意思是找檔名末尾是 .js 或 .jsx 的
*/
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
},
},
{
test: /\.html$/,
use: [
{
loader: "html-loader"
}
]
},
{
// test: /\.(png|jpg|gif|svg|jpeg)$/,
// test: /\.(png|jpe|jpg|woff|woff2|eot|ttf|svg|jpeg)(\?.*$|$)/,
test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/,
use: [
{
loader: 'file-loader?limit=100000&name=[name].[ext]',
options: {},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
]
},
devServer: {
historyApiFallback: true,
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
}),
new webpack.DefinePlugin({
'process.env': envKeys
}),
]
};