-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
80 lines (78 loc) · 2.09 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
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const base = (inFile, outFile, target) => ({
devtool: 'source-map',
target,
entry: {
[outFile]: `./src/${inFile}`,
},
output: {
filename: '[name]',
path: path.join(__dirname, './web'),
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: {
loader: 'css-loader',
query: {
minimize: true,
},
},
}),
},
{
test: /\.pug$/,
loader: 'pug-loader',
query: {
pretty: true,
},
},
{
test: /\.(svg|ttf|woff2?|eot)$/,
use: {
loader: "url-loader",
query: {
limit: 8092,
},
}
}
],
noParse: [path.join(__dirname, 'node_modules/handsontable/dist/handsontable.full.js')],
},
node: {
__filename: false,
__dirname: false,
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js'],
alias: {
'handsontable': path.join(__dirname, 'node_modules/handsontable/dist/handsontable.full.js'),
'handsontable.css': path.join(__dirname, 'node_modules/handsontable/dist/handsontable.full.css'),
},
},
plugins: [
new webpack.optimize.UglifyJsPlugin({ sourceMap: true }),
new ExtractTextPlugin('[name]'),
new HtmlWebpackPlugin({ filename: 'index.html', template: './src/index.pug' }),
new CopyWebpackPlugin([
{ from: "./src/package.json", to: "." },
{ from: "./src/schema_example.js", to: "." },
]),
],
});
module.exports = [
base("index.ts", "index.js", "electron"),
base("main.ts", "main.js", "electron-renderer"),
base("main.css", "main.css", "web"),
];