refactor: public

This commit is contained in:
cha0s 2022-04-05 06:01:08 -05:00
parent d3fb00ff84
commit de75b48519
3 changed files with 17 additions and 5 deletions

View File

@ -34,7 +34,7 @@ export default {
/**
* The URL to load in electron by default.
*
* Defaults to `http://localhost:${flecks.get('@flecks/web/server.port')}`.
* Defaults to `http://${flecks.get('@flecks/web/server.public')}:${flecks.get('@flecks/web/server.port')}`.
*/
url: undefined,
}),
@ -80,9 +80,8 @@ export default {
await createWindow(flecks);
},
'@flecks/electron/server.window': async (win, flecks) => {
const {
url = `http://localhost:${flecks.get('@flecks/web/server.port')}`,
} = flecks.get('@flecks/electron/server');
const {public: $$public} = flecks.get('@flecks/web/server');
const {url = `http://${$$public}`} = flecks.get('@flecks/electron/server');
await win.loadURL(url);
},
'@flecks/server.up': async (flecks) => {

View File

@ -7,6 +7,7 @@ module.exports = (flecks) => (neutrino) => {
devPublic,
devStats,
port,
public: $$public,
} = flecks.get('@flecks/web/server');
neutrino.use(devServer({
historyApiFallback: {
@ -15,7 +16,7 @@ module.exports = (flecks) => (neutrino) => {
hot: false,
host: devHost,
port: devPort || (port + 1),
public: devPublic,
public: devPublic || $$public,
stats: {
...devStats,
warningsFilter: [

View File

@ -113,6 +113,12 @@ export default {
'postcss.config.js',
],
'@flecks/core.config': () => ({
/**
* (webpack-dev-server) Disable the host check.
*
* See: https://github.com/webpack/webpack-dev-server/issues/887
*/
devDisableHostCheck: false,
/**
* (webpack-dev-server) Host to bind.
*/
@ -123,6 +129,8 @@ export default {
devPort: undefined,
/**
* (webpack-dev-server) Public path to serve.
*
* Defaults to `flecks.get('@flecks/web/server.public')`.
*/
devPublic: undefined,
/**
@ -154,6 +162,10 @@ export default {
* Port to bind.
*/
port: 32340,
/**
* Public path to server.
*/
public: 'localhost:32340',
/**
* Webpack stats configuration when building HTTP target.
*/