Skip to content

Commit 85a8b51

Browse files
trallardgabalafou
andauthored
Add build comments to webpack.config.js
Co-authored-by: gabalafou <[email protected]>
1 parent 0f3aa5c commit 85a8b51

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

webpack.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ var config = {
174174
};
175175

176176
module.exports = (env, argv) => {
177-
// since STB isolates the build, we need to compile the translations here for releases
177+
// Sphinx Theme Builder creates a completely isolated working directory
178+
// when packaging the theme. That means that we cannot follow a workflow
179+
// like this:
180+
// 1. run command to compile the translations
181+
// 2. run command to package the theme (`stb package`)
182+
// We must instead compile the translations **as part of** the command
183+
// that builds the theme:
184+
// 1. command to package theme
185+
// a. compile translations
186+
// The theme builder calls `npm run-script build`, which we have configured
187+
// to call `webpack --mode=production` (which calls this file), which is why
188+
// we compile the translations here.
178189
if (argv.mode === 'production') {
179190
exec(`pybabel compile -d ${localePath} -D sphinx`, (error, stdout, stderr) => {
180191
if (error) {

0 commit comments

Comments
 (0)