longclawshop / longclaw

A shop for Wagtail CMS
MIT License
396 stars 83 forks source link

Client Bundle Webpack Error #344

Open glen-smudge opened 4 years ago

glen-smudge commented 4 years ago

longclaw version: 1.0.2 Django version: 3.1 Python version: 3.8.3

I'm trying to load the javascript libraries using the longclaw template tags into the supplied product template (catalog/template/catalog/product.html):

{% load static core_tags wagtailimages_tags longclawcore_tags %}

... HTML ...

{% longclaw_vendors_bundle %}
{% longclaw_client_bundle %}

When loading the page I get an error from longclawclient.bundle.js:

Uncaught ReferenceError: webpackJsonp is not defined at longclawclient.bundle.js:1

The vendors bundle is loading correctly before the client bundle, the files are loaded from the virtaulenv: {project}/lib/python3.8/site-packages/longclaw/static/core/js/vendors.bundle.js {project}/lib/python3.8/site-packages/longclaw/static/core/js/longclawclient.bundle.js

The project is was scaffolded with the longclaw CLI.

akshayaureatelabs commented 1 year ago

longclaw version: 1.0.2 Django version: 3.1 Python version: 3.8.3

I'm trying to load the javascript libraries using the longclaw template tags into the supplied product template (catalog/template/catalog/product.html):

{% load static core_tags wagtailimages_tags longclawcore_tags %}

... HTML ...

{% longclaw_vendors_bundle %}
{% longclaw_client_bundle %}

When loading the page I get an error from longclawclient.bundle.js:

Uncaught ReferenceError: webpackJsonp is not defined at longclawclient.bundle.js:1

The vendors bundle is loading correctly before the client bundle, the files are loaded from the virtaulenv: {project}/lib/python3.8/site-packages/longclaw/static/core/js/vendors.bundle.js {project}/lib/python3.8/site-packages/longclaw/static/core/js/longclawclient.bundle.js

The project is was scaffolded with the longclaw CLI.

@glenatmake @janbaykara Hello, It seems that the error you are encountering is related to the Webpack runtime not being able to find the global webpackJsonp function, which is usually defined in the vendors.bundle.js file.

Here are some steps you can take to try to resolve the issue:

  1. Make sure that you have installed all the required dependencies for your project, especially those related to Webpack and its plugins.

  2. Check that the vendors.bundle.js file is being loaded correctly and that it defines the webpackJsonp function. You can do this by opening the file in a text editor or using the browser's developer tools to inspect the loaded script.

  3. Verify that the longclawclient.bundle.js file is being loaded after the vendors.bundle.js file. You can do this by inspecting the network requests in your browser's developer tools.

  4. If the above steps do not resolve the issue, you can try rebuilding the bundles using Webpack. You can do this by running the npm run build command in your project's root directory. This will rebuild the client and vendor bundles and place them in the static/ directory.

Thank you!