Skip to content

Instantly share code, notes, and snippets.

@milkmidi
Last active August 7, 2019 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milkmidi/e08dd4411b5e4bbe0eadfbd345729b50 to your computer and use it in GitHub Desktop.
Save milkmidi/e08dd4411b5e4bbe0eadfbd345729b50 to your computer and use it in GitHub Desktop.
weinre-webpack-plugin
doctype html
html
head
meta(charset='UTF-8')
title webpack 4
if weinreScript
script(src=weinreScript)
body
h1#info milkmidi
const getLocalhostIPAddress = () => {
const ifs = require('os').networkInterfaces();
const host = `${Object.keys(ifs).map(x => ifs[x].filter(x => x.family === 'IPv4' && !x.internal)[0]).filter(x => x)[0].address}`;
return host || 'localhost';
};
module.exports = {
module:{
{
test: /\.pug$/,
use: [
{ loader: 'html-loader' },
{
loader: 'pug-html-loader',
options: {
pretty: DEV_MODE,
data: {
DEV_MODE,
weinreScript: process.env.WEINRE ? `http://${getLocalhostIPAddress()}:8000/target/target-script-min.js#anonymous` : false,
},
},
},
],
include: path.resolve('src/html'),
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment