-
-
Notifications
You must be signed in to change notification settings - Fork 303
Expand file tree
/
Copy pathwebpack.node-tests.js
More file actions
93 lines (91 loc) · 1.98 KB
/
webpack.node-tests.js
File metadata and controls
93 lines (91 loc) · 1.98 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const webpack = require('webpack')
module.exports = {
mode: 'development',
target: 'node',
devtool: 'inline-source-map',
entry: {
'fake-tests': path.join(__dirname, 'src', 'entries', 'test-node.js'),
},
output: {
path: path.resolve(__dirname, 'dist', 'node-tests'),
filename: '[name].js',
},
externals: {
mocha: 'commonjs mocha',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: { version: '3.19', proposals: true },
shippedProposals: true,
},
],
],
},
},
},
],
},
resolve: {
extensions: ['.js', '.ts', '.json'],
alias: {
'@capacitor/preferences': path.resolve(
__dirname,
'src',
'test',
'node-shims',
'capacitor-preferences.js'
),
'@capacitor/share': path.resolve(
__dirname,
'src',
'test',
'node-shims',
'capacitor-share.js'
),
'@capacitor/filesystem': path.resolve(
__dirname,
'src',
'test',
'node-shims',
'capacitor-filesystem.js'
),
'@sentry/browser': path.resolve(
__dirname,
'src',
'test',
'node-shims',
'sentry-browser.js'
),
},
},
plugins: [
new webpack.DefinePlugin({
BROWSERSLIST_REGEX: require('./supportedBrowsers'),
IS_BROWSER: 'false',
}),
],
}