Javascript 如何使用parceljs将我的起始url更改为自定义url
任何帮助都将不胜感激。当前url为。我希望这是一个自定义url,用于向第三方服务进行身份验证,该服务只允许对这些url进行身份验证。您可以根据需要使用Javascript 如何使用parceljs将我的起始url更改为自定义url,javascript,parceljs,Javascript,Parceljs,任何帮助都将不胜感激。当前url为。我希望这是一个自定义url,用于向第三方服务进行身份验证,该服务只允许对这些url进行身份验证。您可以根据需要使用--host选项 因此,在脚本部分: { "name": "openlayers", "version": "1.0.0", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1",
--host
选项
因此,在脚本部分:
{
"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"
}
您必须将域添加到主机文件中,然后按照上面所述操作
"start": "parcel serve index.html --host example.com",
不工作-TypeError:无法读取null的属性“port”-即使它指定了端口“start”:“packet serve index.html--host example.com--port 1234”,如果您重新加载了热模块,然后可以尝试使用
--hmr hostname
。仍然不工作的服务器表示,您也可以在主机文件中输入所需域的条目,并将其指向127.0.0.1。这样您就可以与第三方进行身份验证。
"start": "parcel serve index.html --host example.com",