forked from stake-house/wagyu-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.react.config.js
46 lines (42 loc) · 1.32 KB
/
webpack.react.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
'use strict';
// pull in the 'path' module from node
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// export the configuration as an object
module.exports = {
// development mode will set some useful defaults in webpack
mode: 'development',
// the entry point is the top of the tree of modules.
// webpack will bundle this file and everything it references.
entry: './src/react/index.tsx',
// we specify we want to put the bundled result in the matching dist/ folder
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist/react'),
},
module: {
// rules tell webpack how to handle certain types of files
rules: [
// at the moment the only custom handling we have is for typescript files
// .ts and .tsx files get passed to ts-loader
{
test: /\.tsx?$/,
loader: 'ts-loader',
}, {
test: /node_modules\/JSONStream\/index\.js$/,
loader: 'shebang-loader'
}
],
},
resolve: {
// specify certain file extensions to get automatically appended to imports
// ie we can write `import 'index'` instead of `import 'index.ts'`
extensions: ['.ts', '.tsx', '.js'],
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/react/index.html',
}),
],
target: 'electron-renderer'
};