-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
50 lines (44 loc) · 1.05 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
46
47
48
49
50
import path from 'path'
import {fileURLToPath} from 'url'
import glob from 'glob'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const testEntries = glob.sync("./src/**/test__*.coffee").reduce((acc, val) => {
const filenameRegex = /test__([\w\d_-]*)\.coffee$/i
acc[val.match(filenameRegex)[1]] = val
return acc
}, {})
const config = {
entry: testEntries,
mode: 'development',
devtool: 'inline-cheap-module-source-map',
// devtool: 'cheap-module-source-map',
output: {
filename: '[name].test.js',
path: path.resolve(__dirname, 'temp'),
clean: true,
},
module: {
rules: [
{
include: [
path.resolve(__dirname),
path.resolve(__dirname, '../comon'),
],
exclude: /node_modules|packages/,
test: /\.coffee$/,
use: [
{loader: 'coffee-loader'},
// {loader: path.resolve(__dirname, '../hack/loaders/keywordCoffeeLoader.js')},
]
},
],
},
target: 'node',
resolve: {
extensions: ['.js', '.coffee'],
alias: {
comon: path.resolve(__dirname, '../comon')
}
},
}
export default config