danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
595 stars 158 forks source link

JavaScript plugin: browser console: Uncaught ReferenceError: django is not defined #331

Closed ManHand1996 closed 2 years ago

ManHand1996 commented 2 years ago

Following the document I build up the frontend packages but using my project (using render tag 'render_comment_list',comment is work, but i don't want the page redirect to another page when reply or post comments)

❯ ./node_modules/webpack/bin/webpack.js -p
Hash: 10c65899282b66fa8f6e
Version: webpack 4.46.0
Time: 2095ms
Built at: 09/08/2021 10:42:44 PM
                     Asset      Size  Chunks                   Chunk Names
           plugin-2.9.2.js  32.7 KiB       0  [emitted]        plugin
       plugin-2.9.2.js.map    68 KiB       0  [emitted] [dev]  plugin
    vendor~plugin-2.9.2.js  46.1 KiB       1  [emitted]        vendor~plugin
vendor~plugin-2.9.2.js.map   194 KiB       1  [emitted] [dev]  vendor~plugin
Entrypoint plugin = vendor~plugin-2.9.2.js vendor~plugin-2.9.2.js.map plugin-2.9.2.js plugin-2.9.2.js.map
[0] external "React" 42 bytes {0} [built]
[1] external "django" 42 bytes {0} [built]
[2] external "jQuery" 42 bytes {0} [built]
[4] external "ReactDOM" 42 bytes {0} [built]
[5] ./django_comments_xtd/static/django_comments_xtd/js/src/index.js + 4 modules 57.8 KiB {0} [built]
    | ./django_comments_xtd/static/django_comments_xtd/js/src/index.js 278 bytes [built]
    | ./django_comments_xtd/static/django_comments_xtd/js/src/commentbox.jsx 13.4 KiB [built]
    | ./django_comments_xtd/static/django_comments_xtd/js/src/lib.js 964 bytes [built]
    | ./django_comments_xtd/static/django_comments_xtd/js/src/commentform.jsx 21.3 KiB [built]
    | ./django_comments_xtd/static/django_comments_xtd/js/src/comment.jsx 22 KiB [built]
    + 1 hidden module
❯ 

I so confused why in this repo, the webpack external module 'django' was found.

I search package 'django' in npm,but not found.

When I start up my project, I got this in the browser console :

external "django":1 Uncaught ReferenceError: django is not defined
    at Object.<anonymous> (external "django":1)
    at o (bootstrap:79)
    at Module.<anonymous> (plugin-2.9.2.js:1)
    at o (bootstrap:79)
    at r (bootstrap:45)
    at bootstrap:152
    at plugin-2.9.2.js:1
(anonymous) @ external "django":1
o @ bootstrap:79
(anonymous) @ plugin-2.9.2.js:1
o @ bootstrap:79
r @ bootstrap:45
(anonymous) @ bootstrap:152
(anonymous) @ plugin-2.9.2.js:1

Am I miss setting something or wrong? Pls help me

ManHand1996 commented 2 years ago

My bad , forgot add 'javascript-catalog' script in template <script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>