-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
67 lines (64 loc) · 1.75 KB
/
webpack.config.js
File metadata and controls
67 lines (64 loc) · 1.75 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
const webpack = require('webpack');
const CopyPlugin = require("copy-webpack-plugin");
let clientConfig = {
//devtool: 'inline-source-map',
target: "electron-renderer",
entry: {
main: `${__dirname}/client.ts`,
},
output: {
path: `${__dirname}/www`,
filename: 'bundle.js'
},
resolve: {
extensions: [".ts", ".js"],
//modules: [`${__dirname}/src`, `${__dirname}/node_modules`]
},
resolveLoader: {
modules: [`${__dirname}/loaders`, `${__dirname}/node_modules`]
},
module: {
rules: [{
test: /\.ts$/, loader: "ts-loader"
}, {
test: /\.less$/,
use: "./loaders/less-loader"
}]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new CopyPlugin([
//{from: `${__dirname}/bower_components/**/*.+(html|js)`, to: `${__dirname}/www`},
{from: `${__dirname}/static`, to: `${__dirname}/www/static`},
{from: `${__dirname}/vendor`, to: `${__dirname}/www/vendor`},
{from: `${__dirname}/index.html`, to: `${__dirname}/www/index.html`}])
],
node: {
__dirname: false,
fs: false
}
};
let electronConfig = {
target: "electron-main",
entry: "./main.js",
output: {
path: `${__dirname}/electron`,
filename: "main.js"
},
module: {
rules: [
{test: /\.ts$/, loader: "ts-loader"}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
modules: [`${__dirname}/src`, `${__dirname}/node_modules`]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin()
],
node: {
__dirname: false
}
};
module.exports = [clientConfig, electronConfig];