search

Home  >  Q&A  >  body text

The production environment encounters Highlight JS issues, while the development environment runs normally

Can anyone figure out the solution why my Highlight JS is not working in production but it works perfectly in production?

I'm using Laravel 10, Cloudflare and Litespeed web server

This is my Highlight JS external CDN

<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" />

This is my script to initialize HighlightJS on post.blade.php

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

I call it on main.blade.php

@stack('script')

thanks for your help

P粉308089080P粉308089080280 days ago391

reply all(1)I'll reply

  • P粉393030917

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

    Now fixed, guys, it was weird, in development server I don't need to use JQuery, but in production server I need to use JQuery initialization code

    reply
    0
  • Cancelreply