-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
68 lines (67 loc) · 1.88 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const path = require('path')
const webpack = require('webpack')
/** @type {webpack.Configuration} */
module.exports = {
entry: path.join(__dirname, './src/index.ts'),
mode: 'none',
output: {
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
optimization: {
minimize: false,
},
target: 'web',
module: {
rules: [
{
test: /\.tsx?$/,
use: [{loader: 'ts-loader', options: {transpileOnly: true}}],
exclude: /node_modules/,
},
{
test: /isomorphic-git/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: [
// isomorphic git uses promises. but we want to avoid the event loop to allow using
// filesystem operations that have synchronous fallbacks. Everything's done in memory
// anyway, so no need for async operations.
// This does _not_ allow doing things like cloning remote repos, but you'd never want to
// do that in a database trigger anyway
'babel-plugin-transform-async-to-promises',
],
},
},
],
},
{
test: /async-lock/,
use: [
{
loader: require.resolve('./webpack/async-lock-shim'),
},
],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
path: require.resolve('path-browserify'),
stream: require.resolve('stream-browserify'),
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: [require.resolve('./webpack/globals'), 'process'],
setTimeout: [require.resolve('./webpack/globals'), 'setTimeout'],
setInterval: [require.resolve('./webpack/globals'), 'setInterval'],
}),
],
}