This is very bizarre as I have a mismatch in behaviour of highlight.js.
This is how I install it:
npm install highlight.js
This is how I initialize it:
import hljs from 'highlight.js/lib/core';
// Particular languages
import bash from 'highlight.js/lib/languages/bash';
import css from 'highlight.js/lib/languages/css';
import javascript from 'highlight.js/lib/languages/javascript';
import php from 'highlight.js/lib/languages/php';
import phpTemplate from 'highlight.js/lib/languages/php-template';
import scss from 'highlight.js/lib/languages/scss';
import xml from 'highlight.js/lib/languages/xml';
import yaml from 'highlight.js/lib/languages/yaml';
hljs.registerLanguage('bash', bash);
hljs.registerLanguage('css', css);
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('php', php);
hljs.registerLanguage('phpTemplate', phpTemplate);
hljs.registerLanguage('scss', scss);
hljs.registerLanguage('xml', xml);
hljs.registerLanguage('yaml', yaml);
// Chosen style (https://highlightjs.org/static/demo/)
import 'highlight.js/styles/github.css';
// Init
hljs.highlightAll();
Lastly I run npm run dev or npm run production. All good. No issues.
Finally when I have a page with <code> and <pre>, the library works perfectly on my local docker and adds its classes.
^11.3.16.14.14v12.22.5Now I have the same website deployed on my server and the code is not highlighted.
There are no issues during npm run production. No issues in the console. No issues printed anywhere. Literally this is the same codebase.
^11.3.16.14.8v14.15.0The only major difference is in node. Server has v14, local docker has v12 but server doesn't show any issues when I build everything.
Can I get any hints what went wrong?