-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
39 lines (37 loc) · 937 Bytes
/
webpack.config.ts
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
import { Configuration } from 'webpack'
import glob from 'glob'
import { promisify } from 'util'
import { join, basename, extname, dirname } from 'path'
import mockResolvePlugin from './mockResolvePlugin'
const config: Configuration = {
entry: async () => Object.fromEntries((await promisify(glob)('__tests__/*.@(ts|js)', {
cwd: 'lib'
}))
// .map(path => join(__dirname, path))
.map(path => [path, {
import: join(__dirname, 'lib', path),
filename: `${dirname(path)}/${basename(path, extname(path))}.js`
}])),
output: {
path: join(__dirname, 'dist'),
clean: true
},
resolve: {
extensions: ['.js', '.ts'],
plugins: [mockResolvePlugin]
},
module: {
rules: [{
test: /.ts/,
exclude: /node_modules/,
loader: 'ts-loader'
}]
},
target: 'node',
mode: 'none',
devtool: 'source-map',
externals: {
fs: 'require("memfs")'
}
}
export default config