Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.react.js
More file actions
Latest commit
66 lines (64 loc) · 1.84 KB
/
Copy pathwebpack.react.js
File metadata and controls
66 lines (64 loc) · 1.84 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
constpath=require('path');
constHtmlWebpackPlugin=require('html-webpack-plugin');
const{ spawn }=require("child_process")
module.exports={
devtool: 'inline-source-map',
entry: './src/react.js',
output: {
path: __dirname+'/build/renderer',
filename: 'bundle.js'
},
target: "electron-renderer",
devServer: {
contentBase: './build/renderer',
port: 8001,
after: ()=>{
letchrome=spawn("./node_modules/electron/dist/electron",["build/electron.js"],{
cwd: process.env["PWD"]
})
chrome.stdout.on("data",(chunk)=>{
console.log("\x1b[34m","Electron says:")
console.log(chunk.toString())
})
chrome.stderr.on("data",chunk=>{
console.log("\x1b[34m","Electron says:")
console.error(chunk.toString())
})
chrome.on("close",()=>{process.exit(0)})
},
open: false
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader',/* 'eslint-loader' */]
},
{
test: /\.(png|svg|jpg|gif)$/,
exclude: /node_modules/,
use: [
'file-loader',
],
},
{
test: /\.css$/,
exclude: /node_modules/,
use: [
'style-loader',
'css-loader',
],
},
]
},
plugins: [
newHtmlWebpackPlugin({
template: path.resolve('./src/index.html'),
}),
],
resolve: {
enforceModuleExtension: false,
extensions: [' ','.jsx','.js']
}
};