From 8e81b0680f407519a789c4f3de6245a8bafd3e72 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 14 Nov 2018 15:48:25 -0800 Subject: feat: expose webpack-dev-server content to local network --- packages/instant/webpack.config.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'packages/instant/webpack.config.js') diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js index 78a33ce90..c566237e6 100644 --- a/packages/instant/webpack.config.js +++ b/packages/instant/webpack.config.js @@ -1,7 +1,8 @@ const path = require('path'); +const ip = require('ip'); // The common js bundle (not this one) is built using tsc. // The umd bundle (this one) has a different entrypoint. -module.exports = { +const config = { entry: './src/index.umd.ts', output: { filename: '[name].bundle.js', @@ -24,5 +25,15 @@ module.exports = { devServer: { contentBase: path.join(__dirname, 'public'), port: 5000, + host: '0.0.0.0', + after: () => { + if (config.devServer.host === '0.0.0.0') { + console.log( + `webpack-dev-server can be accessed externally at: ${ip.address()}:${config.devServer.port}`, + ); + } + }, }, }; + +module.exports = config; -- cgit v1.2.3