This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
107 lines (101 loc) · 2.79 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
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
const path = require('path');
const webpack = require('webpack');
const port = process.env.PORT || '8080';
const config = {
context: __dirname,
}
module.exports = {
context: __dirname,
entry: [
'./components/index.js',
'./www/styles.css',
'babel-polyfill',
path.resolve(__dirname, './components/index.js'),
`webpack-hot-middleware/client?path=http://localhost:${port}/__webpack_hmr`,
],
target: 'electron-renderer',
output: {
filename: 'renderer.bundle.js',
path: __dirname + '/bundle',
publicPath: `http://localhost:${port}/bundle/`,
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{ test: /\.(js|jsx)$/,
loader: 'babel-loader',
include: [
path.join(__dirname, 'components'),
path.join(__dirname, './components/index.js')
],
exclude: /node_modules/,
query: {
presets: ['es2015', 'react', 'react-hmre']
}
},
{ test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader' },
{
test: /\.css$/,
loaders: ["style-loader","css-loader"]
},
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
{
test: /\.json$/,
loader: 'json-loader'
},
{ test: /\.gif$/, loader: "url-loader?mimetype=image/png" },
{ test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader?name=[name].[ext]" }
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
]
};
/*output: {
path: path.join(__dirname, 'www'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [
'babel-loader',
],
},
{
test: /\.css$/,
loaders: ["style-loader","css-loader"]
},
{
test: /\.(jpe?g|png|gif)$/i, //to support eg. background-image property
loader:"file-loader",
query:{
name:'[name].[ext]',
outputPath:'images/'
//the images will be emmited to public/assets/images/ folder
//the images will be put in the DOM <style> tag as eg. background: url(assets/images/image.png);
}
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, //to support @font-face rule
loader: "url-loader",
query:{
limit:'10000',
name:'[name].[ext]',
outputPath:'fonts/'
//the fonts will be emmited to public/assets/fonts/ folder
//the fonts will be put in the DOM <style> tag as eg. @font-face{ components:url(assets/fonts/font.ttf); }
}
}
],
},
resolve: {
modules: [
path.join(__dirname, 'node_modules'),
],
},
};
*/