This repository was archived by the owner on Mar 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
111 lines (105 loc) · 2.8 KB
/
webpack.config.ts
File metadata and controls
111 lines (105 loc) · 2.8 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import * as path from 'path';
import * as webpack from 'webpack';
import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
module.exports = {
entry: {
"main": './src/main-process/main.ts',
"renderer": './src/ui/renderer.tsx'
},
output: {
path: path.join(__dirname, 'output-code/'),
filename: '[name].js'
},
target: "electron",
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{test: /\.tsx?$/, loader: 'ts-loader', options: { silent: true }},
{
test: /\.css$/,
exclude: /(node_modules)/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: { sourceMap: true }
}
]
})
},
{
test: /\.less$/,
exclude: /(node_modules)/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: { sourceMap: true }
},
{
loader: 'less-loader',
options: { sourceMap: true }
}
]
})
},
{
test: /\.html$/,
loader: "raw-loader"
},
{
test: /\.svg(?:[?#]|$)/,
loader: "url-loader",
options: { limit: 10000 }
}, {
test: /\.png(?:[?#]|$)/,
loader: "url-loader",
options: { limit: 10000 }
}, {
test: /\.gif(?:[?#]|$)/,
loader: "url-loader",
options: { limit: 10000 }
}, {
test: /\.jpg(?:[?#]|$)/,
loader: "url-loader",
options: { limit: 10000 }
}
],
noParse: /node_modules\/json-schema\/lib\/validate\.js/
},
plugins: getPlugins(),
externals: getExternals(),
node: {
console: false,
global: false,
process: false,
Buffer: false,
__filename: false,
__dirname: false
},
devtool: 'source-map'
};
function getPlugins() {
return [
new webpack.DefinePlugin({
"global.GENTLY": false,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new ExtractTextPlugin({filename: '[name].css'}),
];
}
export function getExternals() {
const modules = [
'nodegit'
];
let externals: any = {};
modules.forEach(m => {
externals[m] = `require("${m}")`;
});
return externals;
}