-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
43 lines (41 loc) · 1.01 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
const path = require("path")
const includeFolder = path.resolve(__dirname, "src")
const outputFolder = path.resolve(__dirname, "lib")
module.exports = (env, argv) => {
const mode = env ? (env.mode == "dev" ? "development" : "production") : "production"
console.log(`running in ${mode} mode`)
return {
entry: "./src/Index.tsx",
mode,
output: {
filename: "index.js",
path: outputFolder,
library: "dynamic-table-react",
libraryTarget: "umd",
},
module: {
rules: [
{
test: /\.css$/i,
include: includeFolder,
use: ["style-loader", "css-loader"],
},
{
// also added typescript files for future
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: includeFolder,
use: {
loader: "babel-loader",
},
},
],
},
externals: {
react: "react",
"react-dom": "react-dom",
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
}
}