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

webpack.dev.config.js should be able to refer to use port number in env.config.js if provided #513

Open
jsnwesson opened this issue Feb 5, 2024 · 0 comments

Comments

@jsnwesson
Copy link

jsnwesson commented Feb 5, 2024

When we eventually move away from using .env configuration files, we'll want to ensure that the webpack.dev.config.js is able to provide the port number from env.config.js.

Currently, the port number for the devserver is determined here, which means that on npm run start it will only ever look at the process.env object for the PORT or it will default to 8080, which isn't ideal for developing with multiple repos running that don't have .env.* files anymore.

To fix this, we would need to figure out a way to bring the port number from env.config.js during runtime in webpack.dev.config.js or require all repos that now use env.config.js to modify the port assignment in their customized webpack dev config.

Example of an MFE with a .env.development AND env.config.js

// ./webpack.dev.config.js

const { createConfig } = require('@edx/frontend-build');

const envConfig = require('./env.config');

const config = createConfig('webpack-dev');

config.devServer.port = envConfig.PORT || process.env.PORT || 8080;

module.exports = config;
@jsnwesson jsnwesson changed the title webpack.dev.config.js should be able to refer to port number in env.config.js if provided webpack.dev.config.js should be able to refer to use port number in env.config.js if provided Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant