Skip to content

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

@jsnwesson

Description

@jsnwesson

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions