-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.workers.js
100 lines (93 loc) · 1.93 KB
/
webpack.config.workers.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// MODULES //
const { DefinePlugin } = require( 'webpack' );
const { join, resolve } = require( 'path' );
const { EsbuildPlugin } = require( 'esbuild-loader' );
// MAIN //
const config = {
module: {
rules: [
{
test: /\.js?$/,
use: [
{
loader: 'esbuild-loader',
options: {
loader: 'jsx',
target: 'es2015'
}
}
],
include: [
join( __dirname, 'app' ),
join( __dirname, '@isle-project' )
]
}
]
},
resolve: {
modules: [
resolve( './' ),
resolve( './app' ),
resolve( './node_modules' )
],
alias: {
'csv-stringify': resolve( './node_modules/csv-stringify/lib/browser/index.js' )
},
fallback: {
'path': resolve( './node_modules/path-browserify' ),
'stream': resolve( './node_modules/stream-browserify' ),
'domain': false
}
},
entry: {
text_clustering_worker: [
'@isle-project/workers/text-clustering'
]
},
output: {
path: join( __dirname, '@isle-project', 'workers' ),
filename: '[name].js',
assetModuleFilename: 'static/media/[hash][ext][query]'
},
optimization: {
minimize: true,
minimizer: [
new EsbuildPlugin({
target: 'es2015',
legalComments: 'none'
})
]
},
plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
})
],
devtool: 'source-map',
externals: {
'axios': 'axios',
'localforage': 'localforage',
'i18next': 'i18next',
'react': 'React',
'react-dom': 'ReactDOM',
'pdfjs-dist/build/pdf.min.js': 'pdfjsLib',
'react-table': 'ReactTable',
'prop-types': 'PropTypes',
'react-draggable': 'ReactDraggable',
'react-list': 'ReactList',
'react-player': 'ReactPlayer',
'pdfmake/build/pdfmake': 'pdfMake',
'pdfmake/build/vfs_fonts.js': 'pdfMake',
'plotly.js': 'Plotly',
'moment': 'moment',
'victory': 'Victory',
'd3': 'd3',
'socket.io-client': 'io',
'js-yaml': 'jsyaml',
'markdown-it': 'markdownit'
}
};
// EXPORTS //
module.exports = config;