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. * 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, url: undefined,
}), }),
@ -80,9 +80,8 @@ export default {
await createWindow(flecks); await createWindow(flecks);
}, },
'@flecks/electron/server.window': async (win, flecks) => { '@flecks/electron/server.window': async (win, flecks) => {
const { const {public: $$public} = flecks.get('@flecks/web/server');
url = `http://localhost:${flecks.get('@flecks/web/server.port')}`, const {url = `http://${$$public}`} = flecks.get('@flecks/electron/server');
} = flecks.get('@flecks/electron/server');
await win.loadURL(url); await win.loadURL(url);
}, },
'@flecks/server.up': async (flecks) => { '@flecks/server.up': async (flecks) => {

View File

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

View File

@ -113,6 +113,12 @@ export default {
'postcss.config.js', 'postcss.config.js',
], ],
'@flecks/core.config': () => ({ '@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. * (webpack-dev-server) Host to bind.
*/ */
@ -123,6 +129,8 @@ export default {
devPort: undefined, devPort: undefined,
/** /**
* (webpack-dev-server) Public path to serve. * (webpack-dev-server) Public path to serve.
*
* Defaults to `flecks.get('@flecks/web/server.public')`.
*/ */
devPublic: undefined, devPublic: undefined,
/** /**
@ -154,6 +162,10 @@ export default {
* Port to bind. * Port to bind.
*/ */
port: 32340, port: 32340,
/**
* Public path to server.
*/
public: 'localhost:32340',
/** /**
* Webpack stats configuration when building HTTP target. * Webpack stats configuration when building HTTP target.
*/ */