Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local static file host on Windows #2321

Merged
merged 1 commit into from Nov 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions webpack.config.js
Expand Up @@ -6,6 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')

const webpackDevServerHost = process.env.WEBPACK_HOT_RELOAD_HOST || '127.0.0.1'
const webpackDevServerFrontendAddr = webpackDevServerHost === '0.0.0.0' ? '127.0.0.1' : webpackDevServerHost

// main = app
// toolbar = toolbar
Expand Down Expand Up @@ -41,7 +42,7 @@ function createEntry(entry) {
? `${process.env.JS_URL}${process.env.JS_URL.endsWith('/') ? '' : '/'}static/`
: process.env.IS_PORTER
? `https://${process.env.PORTER_WEBPACK_HOST}/static/`
: `http${process.env.LOCAL_HTTPS ? 's' : ''}://${webpackDevServerHost}:8234/static/`,
: `http${process.env.LOCAL_HTTPS ? 's' : ''}://${webpackDevServerFrontendAddr}:8234/static/`,
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
Expand Down Expand Up @@ -196,7 +197,7 @@ function createEntry(entry) {
? new URL(process.env.JS_URL).host
: process.env.IS_PORTER
? `${process.env.PORTER_WEBPACK_HOST}`
: `${webpackDevServerHost}:8234`,
: `${webpackDevServerFrontendAddr}:8234`,
allowedHosts: process.env.IS_PORTER
? [`${process.env.PORTER_WEBPACK_HOST}`, `${process.env.PORTER_SERVER_HOST}`]
: [],
Expand Down