Maison  >  Questions et réponses  >  le corps du texte

L'environnement de production rencontre des problèmes Highlight JS, alors que l'environnement de développement fonctionne normalement

Quelqu'un peut-il trouver la solution pour laquelle mon Highlight JS ne fonctionne pas en production mais fonctionne parfaitement en production ?

J'utilise le serveur Web Laravel 10, Cloudflare et Litespeed

Voici mon CDN externe Highlight JS

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github-dark.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
<script src="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.css" />

Voici mon script pour initialiser HighlightJS sur post.blade.php

@push('script')
    <script>
        hljs.addPlugin(new CopyButtonPlugin());
        hljs.highlightAll();
    </script>
@endpush

Je l'appelle sur main.blade.php

@stack('script')

Merci pour votre aide

P粉308089080P粉308089080210 Il y a quelques jours330

répondre à tous(1)je répondrai

  • P粉393030917

    P粉3930309172024-02-26 15:23:25

    Maintenant corrigé, les gars, c'était bizarre, sur le serveur de développement, je n'ai pas besoin d'utiliser JQuery, mais sur le serveur de production, je dois utiliser le code d'initialisation JQuery

    sssccc

    répondre
    0
  • Annulerrépondre