-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.cjs
More file actions
96 lines (84 loc) · 1.91 KB
/
webpack.config.cjs
File metadata and controls
96 lines (84 loc) · 1.91 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
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
const path = require('path');
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
// Specify that we're in development or production
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
// Entry points - dynamically created from serverless.yml
entry: slsw.lib.entries,
// Target node.js environment
target: 'node',
// Enable source maps
devtool: 'source-map',
experiments: {
outputModule: true,
},
// Resolve .ts and .js extensions
resolve: {
extensions: ['.ts', '.js', '.json'],
fallback: {
"path": false,
"fs": false
}
},
// Output configuration
output: {
library: {
type: 'module',
},
module: true,
environment: {
module: true,
},
path: path.join(__dirname, '.webpack'),
filename: '[name].mjs',
sourceMapFilename: '[file].map',
chunkFormat: 'module',
},
// External modules (modules that should not be bundled)
externals: [
nodeExternals({
allowlist: [
'webpack/hot/poll?1000',
/\.(eot|woff|woff2|ttf|otf)(\?.*)?$/,
'moment-timezone'
],
importType: 'module',
}),
],
// Module rules for TypeScript
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
compilerOptions: {
module: 'ESNext',
moduleResolution: 'node',
}
},
},
],
},
],
},
// Optimization
optimization: {
minimize: false, // Lambda doesn't need minified code
},
// Performance hints
performance: {
hints: false,
},
// Stats configuration for build output
stats: {
colors: true,
reasons: true,
chunks: false,
},
};