Skip to content

Conversation

@ARMBouhali
Copy link
Contributor

@ARMBouhali ARMBouhali commented Oct 28, 2022

A small fix for issue #71 to avoid overwriting the local webpack.dev.config.js in MFEs with the plugin's version of the file mounted at container start

The MFEs targetted by this all have a local webpack.dev.config.js. Here are the ones branched for the olive release:

frontend-app-gradebook
frontend-app-publisher
frontend-app-ora-grading
frontend-app-communications
frontend-app-program-console
frontend-app-learner-dashboard
frontend-app-library-authoring

To account for the 2 possible cases for all MFEs, the fix was tested and confirmed to work with:

  • frontend-app-gradebook (using local config)
  • frontend-app-learning (using config resolved from frontend-platform)

The modification in Dockerfile won't trigger a long image rebuild as it affects only the last step (CMD).

My choice at the moment was to rename the plugin's webpack.dev.config.js to webpack.dev-tutor.config.js.
Please tell me if another file name or location is preferable (e.g. tutor/webpack.dev.config.js)
.

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this change myself but it looks good to me!

@ARMBouhali
Copy link
Contributor Author

@arbrandes would you mind having a quick look ?
Thanks.

@arbrandes arbrandes linked an issue Nov 7, 2022 that may be closed by this pull request
3 tasks
Copy link
Collaborator

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with a single question which you can tackle at your discretion.


const baseDevConfig = require('@edx/frontend-build/config/webpack.dev.config.js');
const baseDevConfig = (
!fs.existsSync('./webpack.dev.config.js')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: wouldn't an affirmation make the code a bit more readable, here? (As opposed to a negation.)

Copy link
Contributor Author

@ARMBouhali ARMBouhali Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a performance viewpoint, most MFEs use the resolved frontend-platform config file (whereas the negation)
But I'd rather have a clearer code reading instead, So I've switched to the affirmative.
@arbrandes

ENV PUBLIC_PATH='/{{ app["name"] }}/'
EXPOSE {{ app['port'] }}
CMD ["npm", "run", "start"]
CMD ["npm", "run", "start", "---", "--config", "./webpack.dev-tutor.config.js"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

fixes issue overhangio#71 for to account for MFEs that have
an existing webpack.dev.config.js
@ARMBouhali ARMBouhali force-pushed the fix-overwriting-existing-webpack-dev-config branch from 886c78b to bb150df Compare November 7, 2022 13:13
@arbrandes arbrandes merged commit 5f019ce into overhangio:master Nov 7, 2022
@arbrandes arbrandes linked an issue Nov 7, 2022 that may be closed by this pull request
@ARMBouhali ARMBouhali deleted the fix-overwriting-existing-webpack-dev-config branch December 27, 2022 15:26
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

Successfully merging this pull request may close these issues.

[tutor-dev] [BUG] webpack.dev.config.js overrides existing file for some MFEs

3 participants