Browse Source

Common webpack options

master
morethanwords 4 years ago
parent
commit
4c7128f8b1
  1. 18
      webpack.common.js

18
webpack.common.js

@ -6,10 +6,10 @@ const postcssPresetEnv = require('postcss-preset-env');
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin'); const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
const fs = require('fs'); const fs = require('fs');
const allowedIPs = ['194.58.97.147', '195.66.140.39', '127.0.0.1', '176.100.8.254']; const allowedIPs = ['127.0.0.1'];
const devMode = process.env.NODE_ENV !== 'production'; const devMode = process.env.NODE_ENV !== 'production';
const useLocal = true; const useLocal = true;
const useLocalNotLocal = true; const useLocalNotLocal = false;
if(devMode) { if(devMode) {
console.log('DEVMODE IS ON!'); console.log('DEVMODE IS ON!');
@ -26,6 +26,9 @@ const opts = {
"ifdef-triple-slash": true // add this to use double slash comment instead of default triple slash "ifdef-triple-slash": true // add this to use double slash comment instead of default triple slash
}; };
const domain = 'yourdomain.com';
const localIp = '192.168.93.209';
module.exports = { module.exports = {
module: { module: {
rules: [ rules: [
@ -104,12 +107,11 @@ module.exports = {
cert: fs.readFileSync(__dirname + '/certs/server-cert.pem', 'utf8') cert: fs.readFileSync(__dirname + '/certs/server-cert.pem', 'utf8')
}, },
allowedHosts: useLocal ? undefined : [ allowedHosts: useLocal ? undefined : [
'tweb.enko.club' domain
], ],
host: useLocalNotLocal ? '192.168.93.209' : (useLocal ? undefined : '0.0.0.0'), host: useLocalNotLocal ? localIp : (useLocal ? undefined : '0.0.0.0'),
public: useLocal ? undefined : 'tweb.enko.club', public: useLocal ? undefined : domain,
//host: '192.168.0.105', // '0.0.0.0' //host: domain, // '0.0.0.0'
//host: 'tweb.enko.club', // '0.0.0.0'
port: useLocal ? undefined : 443, port: useLocal ? undefined : 443,
overlay: true, overlay: true,
before: useLocal ? undefined : function(app, server, compiler) { before: useLocal ? undefined : function(app, server, compiler) {
@ -133,7 +135,7 @@ module.exports = {
} }
}); });
}, },
sockHost: useLocal ? undefined : 'tweb.enko.club', sockHost: useLocal ? undefined : domain,
}, },
plugins: [ plugins: [

Loading…
Cancel
Save