forked from ntv1000/reddit-submission-finder
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
33 lines (27 loc) · 810 Bytes
/
index.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
const path = require('path');
const dotenv = require('dotenv');
const express = require('express');
const webpack = require('webpack');
const middleware = require('webpack-dev-middleware');
const webpackConfig = require('./webpack.config.js');
const compiler = webpack({ ...webpackConfig, mode: 'development' });
dotenv.config();
const DEV = process.env.NODE_ENV !== 'production';
const PORT = process.env.PORT || 3000;
const app = express();
app.use(
middleware(compiler, {
noInfo: true,
writeToDisk: true,
})
);
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'popup.html'));
});
app.listen(PORT, err => {
const info = `==> Listening on port ${PORT} Open up http://127.0.0.1:${PORT} dev:${DEV}`;
if (err) {
console.error(err);
}
console.info(info);
});