-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.cjs
49 lines (47 loc) · 1.33 KB
/
webpack.config.cjs
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
const slsw = require('serverless-webpack');
const path = require("path");
module.exports = {
entry: slsw.lib.entries,
// target: "node",
externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
// externals: {bufferutil: "bufferutil", "utf-8-validate": "utf-8-validate" },
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
devtool: "inline-source-map",
output: {
path: path.resolve(__dirname, '.webpack'),
filename: '[name].mjs',
chunkFormat: "module",
libraryTarget: "module",
module: true
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"],
// Add support for TypeScripts fully qualified ESM imports.
extensionAlias: {
".js": [".js", ".ts"],
".cjs": [".cjs", ".cts"],
".mjs": [".mjs", ".mts"]
}
},
module: {
rules: [
// all files with a `.ts`, `.cts`, `.mts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.([cm]?ts|tsx)$/,
loader: "ts-loader",
exclude: [
[
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, '.serverless'),
path.resolve(__dirname, '.webpack'),
],
],
}
]
},
experiments: {
topLevelAwait: true,
outputModule: true
},
};