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

fix: Write webpack stats file to right place (so static assets can load) #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timmc-edx
Copy link
Member

@timmc-edx timmc-edx commented Nov 4, 2024

After the removal of paver, static assets build wasn't completing properly in edxapp -- static files were written to the correct directory in the assets volume (mounted under /edx/var) but the webpack-stats.json files were written to the test_root dir in the app container (under /edx/app). The service would fail on first page load as it failed to find the stats file, which is apparently used for locating resources.

The static assets build was also taking quite a long time and a lot of CPU, which is likely because we were doing the production-style build with full optimization.

  • Set static-root environment variables so that webpack-stats.json is written to the right place. See staticRootLms and staticRootCms in webpack.common.config.js in edx-platform for where that default is set. Set both LMS/CMS vars for both lms and cms since there's some dependency of CMS on LMS in the logic (and both calls build both sets of files, for better or worse).
  • Use npm dev build for reduced optimization (faster build).
  • Use --settings devstack_docker in the Makefile call to collectstatic; I'm not actually sure what the impact of that is, but it's what was in the provisioning script's version of the call and I needed to deduplicate these calls.
  • Have provision-lms.sh just call the Makefile so that there aren't two sources of truth on how to build static assets for edxapp.

Also:

  • Use same spelling of --no-input for both calls (either works, just make it uniform)

Addresses #65


I've completed each of the following or determined they are not applicable:

  • Made a plan to communicate any major developer interface changes (or N/A)

After the removal of paver, static assets build wasn't completing properly
in edxapp -- static files were written to the correct directory in the
assets volume (mounted under /edx/var) but the webpack-stats.json files
were written to the test_root dir in the app container (under /edx/app).
The service would fail on first page load as it failed to find the stats
file, which is apparently used for locating resources.

The static assets build was also taking quite a long time and a lot of CPU,
which is likely because we were doing the production-style build with full
optimization.

- Set static-root environment variables so that webpack-stats.json is
  written to the right place. See `staticRootLms` and `staticRootCms` in
  `webpack.common.config.js` in edx-platform for where that default is set.
  Set both LMS/CMS vars for both lms and cms since there's some dependency
  of CMS on LMS in the logic (and both calls build both sets of files, for
  better or worse).
- Use npm dev build for reduced optimization (faster build).
- Use `--settings devstack_docker` in the Makefile call to collectstatic;
  I'm not actually sure what the impact of that is, but it's what was in
  the provisioning script's version of the call and I needed to deduplicate
  these calls.
- Have `provision-lms.sh` just call the Makefile so that there aren't two
  sources of truth on how to build static assets for edxapp.

Also:

- Use same spelling of `--no-input` for both calls (either works, just
  make it uniform)

Addresses #65
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.

1 participant