1 const fs = require('fs')
2 const path = require("path")
3 const webpack = require("webpack")
4 const HtmlWebpackPlugin = require('html-webpack-plugin')
6 // defines where the bundle file will live
7 const bundlePath = path.resolve(__dirname, "dist/")
9 module.exports = (_env,argv)=> {
12 path:"./src/VideoComponent.js",
13 outputHtml:"video_component.html",
17 path:"./src/VideoOverlay.js",
18 outputHtml:"video_overlay.html",
22 path:"./src/Panel.js",
23 outputHtml:"panel.html",
27 path:"./src/Config.js",
28 outputHtml:"config.html",
32 path:"./src/LiveConfig.js",
33 outputHtml:"live_config.html",
37 path:"./src/Mobile.js",
38 outputHtml:"mobile.html",
45 // edit webpack plugins here!
49 for(name in entryPoints){
50 if(entryPoints[name].build){
51 entry[name]=entryPoints[name].path
52 if(argv.mode==='production'){
53 plugins.push(new HtmlWebpackPlugin({
56 template:'./template.html',
57 filename:entryPoints[name].outputHtml
64 //entry points for webpack- remove if not used/needed
67 minimize: false // neccessary to pass Twitch's review process
73 exclude: /(node_modules|bower_components)/,
74 loader: 'babel-loader',
75 options: { presets: ['@babel/preset-env'] }
79 use: [ 'style-loader', 'css-loader' ]
82 test: /\.(jpe?g|png|gif|svg)$/i,
83 loader: "file-loader",
85 name:"img/[name].[ext]"
90 resolve: { extensions: ['*', '.js', '.jsx'] },
92 filename: "[name].bundle.js",
97 if(argv.mode==='development'){
99 allowedHosts: ['all'],
100 host:argv.devrig ? 'localhost.rig.twitch.tv' : 'local-ip',
102 'Access-Control-Allow-Origin': '*'
106 if(fs.existsSync(path.resolve(__dirname,'conf/server.key'))){
107 config.devServer.server = {
110 key:fs.readFileSync(path.resolve(__dirname,'conf/server.key')),
111 cert:fs.readFileSync(path.resolve(__dirname,'conf/server.crt'))