-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
57 lines (54 loc) · 1.23 KB
/
Copy pathwebpack.config.ts
File metadata and controls
57 lines (54 loc) · 1.23 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
import path from "path";
import webpack, { Configuration } from "webpack";
import nodeExternals from "webpack-node-externals";
const distPath = path.resolve(__dirname, "dist");
const config: Configuration = {
mode: "production",
entry: "./src/index.ts",
output: {
path: distPath,
filename: "abledev-cli.js",
library: {
name: "abledev-cli",
type: "umd",
},
globalObject: "this",
},
externalsPresets: { node: true },
target: "node",
externals: [nodeExternals()],
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
resourceQuery: { not: [/raw-file/] },
use: [
{
loader: "ts-loader",
options: {
compilerOptions: {
declaration: true,
outDir: distPath,
},
},
},
{
loader: "shebang-loader",
},
],
},
{ resourceQuery: /raw-file/, type: "asset/source" },
],
},
resolve: {
extensions: [".ts", ".tsx", ".ts", ".js"],
},
optimization: {
minimize: false,
},
plugins: [
new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true }),
],
};
export default config;