Skip to content

Commit

Permalink
fix(atomic): make sure Stencil start on the good port (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart authored Mar 1, 2022
1 parent 363bc47 commit 662746c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/create-atomic/template/start-netlify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const args = process.argv.slice(2);

const main = async () => {
// Dynamic Stencil port discovery feature, unsupported by Netlify.
const stencilPort = await getPort({port: portNumbers(3333, 3399)});
const stencilPort =
process.env.STENCIL_PORT || (await getPort({port: [3333]}));

process.on('SIGINT', () => {
// Intermittent issue with Netlify not shutting down Stencil port properly.
Expand All @@ -26,6 +27,7 @@ const main = async () => {
],
{
stdio: 'inherit',
env: {STENCIL_PORT: stencilPort, ...process.env},
}
);
};
Expand Down
3 changes: 3 additions & 0 deletions packages/create-atomic/template/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export const config: Config = {
copy: [{src: 'pages', keepDirStructure: false}],
},
],
devServer: {
port: parseInt(process.env.STENCIL_PORT) || 3333,
},
plugins: [dotenvPlugin()],
rollupPlugins: {
before: [
Expand Down

0 comments on commit 662746c

Please sign in to comment.