fix(webpack): give reveal.js's marked.js a 'exports' variable

I really don't know why this breaks only in a production build, but this
 evil
 hack makes the script work again.

 Closes https://github.com/hedgedoc/hedgedoc/issues/3862

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2023-05-28 18:21:22 +02:00 committed by Tilman Vatteroth
parent 18fad4a6fa
commit b1928b77b4
2 changed files with 7 additions and 1 deletions

View file

@ -12,6 +12,7 @@ You now need Node 16 to run HedgeDoc. We don't support more recent versions of N
### Bugfixes ### Bugfixes
- Fix that permission errors can break existing connections to a note, causing inconsistent note content and changes not being saved - Fix that permission errors can break existing connections to a note, causing inconsistent note content and changes not being saved
- Fix speaker notes not showing up in the presentation view
## <i class="fa fa-tag"></i> 1.9.7 <i class="fa fa-calendar-o"></i> 2023-02-19 ## <i class="fa fa-tag"></i> 1.9.7 <i class="fa fa-calendar-o"></i> 2023-02-19

View file

@ -129,7 +129,12 @@ module.exports = {
{ {
context: path.join(__dirname, 'node_modules/reveal.js'), context: path.join(__dirname, 'node_modules/reveal.js'),
from: 'plugin', from: 'plugin',
to: 'reveal.js/plugin' to: 'reveal.js/plugin',
transform (content, path) {
// The marked.js script wants a 'exports' variable and is referenced from plugin/notes/notes.html
// we copy, so just patch that to give it one.
return content.toString().replace('<script src="../../plugin/markdown/marked.js"></script>', '<script>var exports = {};</script><script src="../../plugin/markdown/marked.js"></script>')
}
} }
] ]
}), }),