forked from reactide/reactide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·65 lines (64 loc) · 1.52 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
const path = require('path');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = {
entry: './renderer/index.js',
output: {
globalObject: 'self',
path: path.resolve(__dirname, 'dist'),
filename: 'webpack-bundle.js',
publicPath: '../dist/',
},
// Compile for Electron for main process.
target: 'electron-main',
// configure whether to polyfill or mock certain Node.js globals
node: {
__dirname: false,
__filename: false
},
module: {
rules: [
{
test: /\.worker\.js$/,
exclude: /node_modules/,
use: {
loader: 'worker-loader',
options: {
name: '[name].js',
},
},
},
{
test: /\.css$/,
use:
process.env.NODE_ENV === 'production'
? [MiniCssExtractPlugin.loader, 'css-loader']
: ['style-loader', 'css-loader'],
},
{
test: /\.scss$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS, using Node Sass by default
]
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /(node_modules|(vendor\/.+.bundle\.js))/,
query: {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
]
}
}
]
},
plugins: [
new MonacoWebpackPlugin()
],
devServer: {
port: 8081
}
}