-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
106 lines (95 loc) · 2.67 KB
/
webpack.common.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
/*
RTreeJS, a JavaScript Tree library that helps to query, insert and delete Rectangles.
Copyright © 2020-2021 Subendra Kumar Sharma. All rights reserved. (jobs.sharma.subendra.kr@gmail.com)
This file is part of RTreeJS.
RTreeJS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RTreeJS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RTreeJS. If not, see <https://www.gnu.org/licenses/>.
Written by Subendra Kumar Sharma.
*/
const fs = require("fs");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const miniCssExtractPlugin = new MiniCssExtractPlugin({
filename: "index.css",
});
const WebpackNotifierPlugin = require("webpack-notifier");
const webpackNotifierPlugin = new WebpackNotifierPlugin({
title: "RTreeJS",
alwaysNotify: true,
});
const Webpack = require("webpack");
const webpackBannerPlugin = new Webpack.BannerPlugin({
banner: fs.readFileSync("./license_header", "utf8"),
raw: true,
});
const CleanTerminalPlugin = require("clean-terminal-webpack-plugin");
const cleanTerminalPlugin = new CleanTerminalPlugin();
module.exports = {
entry: __dirname + "/src/index.ts",
optimization: {
minimize: process.env.MINIMIZE === "true",
},
output: {
publicPath: "assets",
library: "RTreeJS",
libraryTarget: "umd",
},
devServer: {
inline: true,
contentBase: "./public",
port: process.env.PORT,
host: "0.0.0.0",
},
module: {
rules: [
{ test: /\.tsx?$/, exclude: /node_modules/, loader: "ts-loader" },
{ test: /\.js$/, exclude: /node_modules/, loader: "source-map-loader" },
// {
// test: /\.js$/,
// exclude: /node_modules/,
// use: "babel-loader",
// },
{
test: /\.json$/,
exclude: /node_modules/,
loader: "json-loader",
},
{
test: /\.(sc|c)ss$/,
exclude: /node_modules/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
hmr: process.env.NODE_ENV === "development",
reloadAll: true,
},
},
"css-loader",
"postcss-loader",
"sass-loader",
],
},
],
},
plugins: [
miniCssExtractPlugin,
webpackNotifierPlugin,
webpackBannerPlugin,
cleanTerminalPlugin,
],
resolve: {
extensions: [".tsx", ".ts", ".js", "jsx"],
alias: {
src: path.resolve(__dirname, "src/"),
},
},
};