prism: importing prism-php package breaks other packages
Information:
- Prism version: 1.23.0
- Plugins: line-numbers
- Environment: webpack
Description
Currently importing scripts in webpack ( due to the failure of the babel plugin ) as follows:
// settings
module.exports = {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
copyright: '©2020 Percipio.London',
entry: {
'app': [
'prismjs',
'prismjs/components/prism-bash',
'prismjs/components/prism-css',
'prismjs/components/prism-docker',
'prismjs/components/prism-git',
'prismjs/components/prism-graphql',
'prismjs/components/prism-javascript',
'prismjs/components/prism-json',
'prismjs/components/prism-markdown',
'prismjs/components/prism-markup',
'prismjs/components/prism-sql',
'prismjs/components/prism-twig',
'prismjs/components/prism-typescript',
'prismjs/components/prism-yaml',
//'prismjs/components/prism-php',
'prismjs/plugins/line-numbers/prism-line-numbers',
'../src/fonts/open-sans-regular.woff',
'../src/fonts/open-sans-regular.woff2',
'../src/fonts/open-sans-italic.woff',
'../src/fonts/open-sans-italic.woff2',
'../src/fonts/open-sans-600.woff',
'../src/fonts/open-sans-600.woff2',
'../src/fonts/open-sans-700.woff',
'../src/fonts/open-sans-700.woff2',
'../src/fonts/open-sans-800.woff',
'../src/fonts/open-sans-800.woff2',
'../src/fonts/source-code-pro-regular.woff',
'../src/fonts/source-code-pro-regular.woff2',
'../src/js/app.ts',
'../src/js/assets/icons.js',
'../src/css/tailwind-base.pcss',
'../src/css/tailwind-components.pcss',
'../src/css/tailwind-utilities.pcss',
'../src/css/app-components.pcss',
'../src/css/app-utilities.pcss',
'../src/css/vendor.pcss',
],
'lazysizes-wrapper': '../src/js/utils/lazysizes-wrapper.ts',
},
extensions: ['.ts', '.js', '.vue', '.json'],
name: 'percipio.london',
paths: {
dist: '../../cms/web/dist/',
},
urls: {
criticalCss: 'https://sandbox.percipio.london/',
publicPath: () => process.env.PUBLIC_PATH || '/dist/',
},
};
You see the imports, and prism-php being commented out.
Prism works fine ( loading with Prism.highlightAll() ) - inside of a Vue app:
mounted() {
window.addEventListener('load', () => {
Prism.highlightAll();
})
}
Code highlighting works as expected, line numbers show up.
Now the odd case: The moment prism-php is uncommented and brought into play, the code highlighting breaks completely. No elements added inside of the code block ( can’t find any spans or classes with tokens or whatsoever )
If I use Twig/CSS/Javascript/Docker/Git/GraphQL … they all work perfect, they all break once prism-php is added into play.
Without the php package

With the php package

I can’t find any errors in the console or in the buildchain whatsoever which could explain what is going on.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
Commits related to this issue
- PHP comment - confirmed broken due to https://github.com/PrismJS/prism/issues/2769 — committed to DevCycleHQ/devcycle-docs by JamieSinn 8 months ago
- feat: Docusaurus3 (#467) * Docusaurus 3 upgrade * Cleanup packages * Cleanup * Fix imports/package * Fix prism dependency * PHP is apparently broken? * PHP comment - confirmed broke... — committed to DevCycleHQ/devcycle-docs by JamieSinn 8 months ago
- Fix PHP highlighting in Docusaurus v3 Not sure why we are not using the Docusaurus file, but have our own: https://github.com/facebook/docusaurus/blob/8dc24b6a98968f585af1bb5e6f8b7a1fcae0d7d4/package... — committed to slumbering/dagger by gerhard 7 months ago
This happens to me too - i’m vendoring PrismJS 1.26. It’s not an issue when i use 1.1.x of this plugin, but when I update to 1.2.x it breaks
Error
I can already confirm:
All these entry points ( with
prism-markup-templatingadded, do work for php now )not using those entrypoints and relying on babel:
with the above babel config, doesn’t highlight the code.