【问题标题】:How to a change my starting url to a custom url using parceljs如何使用 parceljs 将我的起始 url 更改为自定义 url
【发布时间】:2019-11-26 16:18:51
【问题描述】:
 {
   "name": "openlayers",
   "version": "1.0.0",
   "main": "index.js",
   "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "start": "parcel  index.html",
   "build": "parcel build --public-url . index.html"
  },
 "author": "",
 "license": "ISC",
 "dependencies": {
 "app-root-path": "^2.2.1",
 "authenticate": "^0.1.5",
 "commonjs": "0.0.1",
 "config": "^3.2.4",
 "document-ready": "^2.0.2",
 "eazy-logger": "^3.0.2",
 "fs": "0.0.1-security",
 "jquery": "^3.4.1",
 "leaflet": "^1.6.0",
 "ol": "^5.3.3",
 "ol-contextmenu": "^3.3.2",
 "ol-hashed": "^2.0.0",
 "ol-layerswitcher": "^3.4.0",
 "proj4": "^2.6.0",
 "sidebar-v2": "^0.4.0",
 "simple-datatables": "^2.1.7",
 "simple-node-logger": "^18.12.23",
 "winston": "^3.2.1",
 "winston-daily-rotate-file": "^3.10.0"
}

任何帮助将不胜感激。当前网址是http://localhost:1234。我希望这是一个自定义 url,用于通过第三方服务进行身份验证,仅允许对这些 url 进行身份验证。

【问题讨论】:

    标签: javascript parceljs


    【解决方案1】:

    您根据documentation 使用--host 选项。

    所以在你的脚本部分:

    "start": "parcel serve index.html --host example.com",
    

    【讨论】:

    • 不起作用 - TypeError: Cannot read property 'port' of null - 即使它指定端口“start”:“parcel serve index.html --host example.com --port 1234”,
    • 如果你有热模块重新加载,那么可以尝试--hmr-hostname
    • 仍然无法正常工作说服务器运行在localhost:2420
    • 您也可以在您想要的域的主机文件中输入一个条目并将其指向 127.0.0.1。这应该可以让您与第三方进行身份验证。
    【解决方案2】:

    您必须将域添加到主机文件,然后按照上述操作。

    "start": "parcel serve index.html --host example.com",
    

    【讨论】:

      猜你喜欢
      • 2020-07-28
      • 1970-01-01
      • 1970-01-01
      • 2017-01-23
      • 2016-03-17
      • 2016-07-03
      • 2019-11-17
      • 2016-05-05
      • 1970-01-01
      相关资源
      最近更新 更多