forked from snabbdom/snabbdom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.webpack.config.cjs
40 lines (39 loc) · 1.02 KB
/
tests.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
const path = require('path')
const isPathInside = require('is-path-inside')
const globby = require('globby')
const outputPath = path.resolve(__dirname, 'build/test')
const makeTestsWebpackConfig = async () => ({
mode: 'development',
target: 'browserslist:defaults',
entry: Object.fromEntries(
(await globby(path.resolve(outputPath, '**/*.js')))
.map((item) => [path.relative(outputPath, item), item])
),
output: {
path: path.resolve(__dirname, 'test-bundles'),
filename: ({ chunk }) => chunk.name
},
module: {
rules: [
{
exclude: (input) => isPathInside(input, path.resolve(__dirname, 'node_modules')),
test: /\.m?js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 3,
}
]
]
}
}
}
]
}
})
module.exports = makeTestsWebpackConfig