-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
importing prism-php package breaks other packages #2769
Comments
after only loading the php language file ( and using a PHP snippet with
|
Prism languages have dependencies and the one loading Prism files is responsible for resolving them. This is a non-trivial task which is why we provide a few ways for doing so. Please use one of the officially supported methods to load languages. They are guaranteed to work and will continue to work in the future.
That is because the default entry file of the The reason PHP fails is that it also depends on our Markup templating component. (Markup Templating exports the |
This is a quick close to be honest @RunDevelopment as you can see I am importing the If I put :
Inside my main |
Also using the babel config as written in the documentation:
simply using:
still doesn't give me anything. See screenshots: The plugin loads but seems to be broken / not triggering - code highlighting is not applied, since no components seem to be loaded: |
On it's turn is what I meant, all packages work ... only the PHP one doesn't, and does break all the rest when it is being added. This wasn't a remark based on "missing dependencies" |
Yeah, we get this kind of issue like once every two months, so I'm quick to close...
I am very sure it was. The error message you provided is a clear indication that Markup Templating isn't loaded.
This doesn't include
@mAAdhaTTah Could you please check this? It seems right to me. Just to make sure: @michtio, the plugin is installed via npm, right? (It's the only thing I can't verify from the information you've given.) |
@michtio Could you please show us the transformed output file that contains the |
Off the top, if you're using the babel plugin, you shouldn't also import all of the dependencies manually. Use |
@mAAdhaTTah it was the one or the other, I tried it without importing all the rest, still no success whatsoever. I will try @RunDevelopment his suggestion with importing |
I can already confirm:
All these entry points ( with not using those entrypoints and relying on babel:
with the above babel config, doesn't highlight the code. |
That's very strange. Could you please provide a project to reproduce this behavior? |
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
|
+1 Reviving this unexpected error encountered with Prism 1.29 via prism-react-renderer 2.0.6. useEffect(() => {
typeof global !== 'undefined' ? (global.Prism = Prism) : (window.Prism = Prism)
require('prismjs/components/prism-bash')
require('prismjs/components/prism-php')
require('prismjs/components/prism-pug')
require('prismjs/components/prism-python')
require('prismjs/components/prism-ruby')
require('prismjs/components/prism-toml')
}, []) I am importing several other language packages via
This was solved by first importing |
I had the exact same issue as @skullface with Docusaurus 3 and their upgraded prism-react-renderer depend. It breaks until we remove the php language option. |
The general issue here remains a combination of doing manual dependency management and including The general problem is experienced as Looking over the issues in this thread, they all seem to be covered by the above solution, so I'm going to close this, as this isn't an issue in Prismjs. If you try the above and are still experiencing issues, please provide a reproduction that I can run and investigate. |
* Docusaurus 3 upgrade * Cleanup packages * Cleanup * Fix imports/package * Fix prism dependency * PHP is apparently broken? * PHP comment - confirmed broken due to PrismJS/prism#2769 * Python highlighting
Not sure why we are not using the Docusaurus file, but have our own: https://github.com/facebook/docusaurus/blob/8dc24b6a98968f585af1bb5e6f8b7a1fcae0d7d4/packages/docusaurus-theme-classic/src/theme/prism-include-languages.ts#L31 PrismJS/prism#2769 was helpful. DevCycleHQ/devcycle-docs#467 was a good reference. Signed-off-by: Gerhard Lazu <[email protected]>
Information:
Description
Currently importing scripts in webpack ( due to the failure of the babel plugin ) as follows:
You see the imports, and
prism-php
being commented out.Prism works fine ( loading with
Prism.highlightAll()
) - inside of a Vue app: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.
The text was updated successfully, but these errors were encountered: