-
Notifications
You must be signed in to change notification settings - Fork 141
/
webpack.config.js
63 lines (62 loc) · 1.75 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
const webpack = require('webpack');
const CopyPlugin = require("copy-webpack-plugin");
const path = require('path');
module.exports = {
target: 'node',
mode: 'production',
stats: {
logging: 'info',
},
entry: "./index.js",
output: {
path: path.resolve(__dirname, 'dist'),
filename: "js/bundle.js",
},
optimization: {
minimize: false,
},
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /spawn-sync/,
}),
// Ignore Moment locales
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
// Keep only YAML from highlight.js languages
new webpack.NormalModuleReplacementPlugin(
/highlight\.js\/lib\/languages\/[^y]/,
require.resolve('./webpack.hjs.language.js'),
),
// Replace Node widget constructor for options theming
new webpack.NormalModuleReplacementPlugin(
/blessed\/lib\/widgets\/node/,
require.resolve('./webpack.node.js'),
),
new webpack.DefinePlugin({
WEBPACK: true,
}),
new CopyPlugin({
patterns: [
{ from: "node_modules/blessed/usr/*", to: "usr/", flatten: true },
],
}),
],
module: {
rules: [
{
test: /ansiimage|filemanager|overlayimage|pty|terminal|tng|video/,
use: 'null-loader',
},
{
test: /index\.js$/,
loader: 'string-replace-loader',
options: {
search: '#!/usr/bin/env node',
replace: '',
}
},
],
},
};