-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (44 loc) · 1.06 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
import { resolve as pathResolve } from "path";
const __dirname = import.meta.dirname;
export default (env, argv) => {
const config = {
entry: argv.mode == "production" ? {
"css-follow-cursor.dist.min": ["./src/index.ts"]
} : {
"css-follow-cursor.dist": ["./src/index.ts"]
},
devtool: argv.mode == "production" ? undefined : false,
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
}
],
},
output: {
filename: "[name].js",
path: pathResolve(__dirname, "dist"),
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
// I hate that TSC's decision to not support module import rewriting has knockoff effects like this
extensionAlias: {
'.js': ['.js', '.ts'],
}
},
plugins: [],
optimization: argv.mode == "production" ? undefined : {
providedExports: true,
usedExports: true,
concatenateModules: true,
flagIncludedChunks: true,
removeAvailableModules: true,
sideEffects: true
},
mode: argv.mode
};
console.log("config.mode:", config.mode);
return config;
};