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/package.json | 3 ++- packages/instant/webpack.config.js | 13 ++++++++++++- yarn.lock | 6 +++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/instant/package.json b/packages/instant/package.json index 3ad043c2b..23e1d57fe 100644 --- a/packages/instant/package.json +++ b/packages/instant/package.json @@ -52,9 +52,9 @@ "@0x/subproviders": "^2.1.4", "@0x/types": "^1.2.1", "@0x/typescript-typings": "^3.0.4", - "bowser": "^2.0.0-beta.3", "@0x/utils": "^2.0.5", "@0x/web3-wrapper": "^3.1.4", + "bowser": "^2.0.0-beta.3", "copy-to-clipboard": "^3.0.8", "ethereum-types": "^1.1.2", "lodash": "^4.17.10", @@ -83,6 +83,7 @@ "awesome-typescript-loader": "^5.2.1", "enzyme": "^3.6.0", "enzyme-adapter-react-16": "^1.5.0", + "ip": "^1.1.5", "jest": "^23.6.0", "make-promises-safe": "^1.1.0", "npm-run-all": "^4.1.2", 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; diff --git a/yarn.lock b/yarn.lock index 568ba5564..3ea8ad3f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8001,10 +8001,14 @@ ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" -ip@^1.1.0, ip@^1.1.5: +ip@^1.1.0: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" +ip@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + ipaddr.js@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.6.0.tgz#e3fa357b773da619f26e95f049d055c72796f86b" -- cgit v1.2.3 From 633d17ffdeed4cd950f9d55f58b572f96390a63a Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 15 Nov 2018 09:41:20 -0800 Subject: fix: add http to external url string --- packages/instant/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js index c566237e6..3129e13a6 100644 --- a/packages/instant/webpack.config.js +++ b/packages/instant/webpack.config.js @@ -29,7 +29,7 @@ const config = { after: () => { if (config.devServer.host === '0.0.0.0') { console.log( - `webpack-dev-server can be accessed externally at: ${ip.address()}:${config.devServer.port}`, + `webpack-dev-server can be accessed externally at: http://${ip.address()}:${config.devServer.port}`, ); } }, -- cgit v1.2.3