如何让webpack dev服务器公开访问?

时间:2017-07-30 08:55:16

标签: node.js reactjs npm webpack webpack-dev-server

https://github.com/nttcom/SkyWay-MultiParty 我在本地运行的webpack dev服务器上测试了这个api 这是成功的 但我想访问其他电脑或智能手机

我该怎么办?我是第一次看到webpack代码

的package.json

{
  "name": "skyway-multiparty",
  "version": "1.0.4",
  "description": "SkyWay js library for multi party apps",
  "homepage": "https://github.com/nttcom/SkyWay-MultiParty",
  "repository": {
    "type": "git",
    "url": "git://github.com/nttcom/SkyWay-MultiParty.git"
  },
  "main": "lib/index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "webpack-dev-server": "webpack-dev-server --host 172.19.1.200 --port 8081 --open --https --content-base ./"
  },

webpack.config.js

const webpack = require('webpack');

const path = require('path');
let _entry;

switch(process.env.NODE_ENV) {
  default:
    _entry = {
      "multiparty": path.join(__dirname, "lib/index.js")
    };
    break;
}

module.exports = {
  entry: _entry,
  devtool: "source-map",
  output: {
    path: path.join(__dirname, "dist"),
    publicPath: '/dist/',
    filename: process.env.NODE_ENV === "production" ? "[name].min.js" : "[name].js"
  },

如何更改此配置文件?

0 个答案:

没有答案