Skip to content
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

fix recursive imports from manifest #57

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

Supermanu
Copy link
Contributor

Hi,
I have an issue with recursive imports from the vite manifest. Let me explain. With the production build, vite is splitting into different chunks my js code, like this for instance :

static/.vite/manifest.json                              6.05 kB │ gzip:   0.96 kB
static/assets/contact_info-BONdzhdf.css                 0.04 kB │ gzip:   0.06 kB
static/assets/annuaire-BD7dvoKS.css                     0.16 kB │ gzip:   0.15 kB
static/assets/menu_bar-B1DNQiR2.css                   243.05 kB │ gzip:  34.83 kB
static/assets/vue-router-oFY6fX0y.js                   88.67 kB │ gzip:  31.06 kB
static/assets/annuaire-Bw0mGyaT.js                    275.47 kB │ gzip:  80.65 kB
static/assets/menu_bar-Cg_ihQeU.js                  1,308.06 kB │ gzip: 341.85 kB

My entry point is only one js file annuaire.js and the vite manifest.json looks like this :

{
  "_contact_info-!~{00h}~.js": {
    "file": "assets/contact_info-BONdzhdf.css",
    "src": "_contact_info-!~{00h}~.js"
  },
  "_contact_info-qI9Vj_GE.js": {
    "file": "assets/contact_info-qI9Vj_GE.js",
    "name": "contact_info",
    "imports": [
      "_menu_bar-Cg_ihQeU.js",
      "_vue-router-oFY6fX0y.js"
    ],
    "css": [
      "assets/contact_info-BONdzhdf.css"
    ]
  },
  "_menu_bar-!~{00b}~.js": {
    "file": "assets/menu_bar-B1DNQiR2.css",
    "src": "_menu_bar-!~{00b}~.js"
  },
  "_menu_bar-Cg_ihQeU.js": {
    "file": "assets/menu_bar-Cg_ihQeU.js",
    "name": "menu_bar",
    "css": [
      "assets/menu_bar-B1DNQiR2.css"
    ]
  },
  "_search-Cdf3p1k0.js": {
    "file": "assets/search-Cdf3p1k0.js",
    "name": "search",
    "imports": [
      "_menu_bar-Cg_ihQeU.js"
    ]
  },
  "_vue-router-oFY6fX0y.js": {
    "file": "assets/vue-router-oFY6fX0y.js",
    "name": "vue-router",
    "imports": [
      "_menu_bar-Cg_ihQeU.js"
    ]
  },
  "annuaire/static/annuaire/js/annuaire.js": {
    "file": "assets/annuaire-Bw0mGyaT.js",
    "name": "annuaire",
    "src": "annuaire/static/annuaire/js/annuaire.js",
    "isEntry": true,
    "imports": [
      "_menu_bar-Cg_ihQeU.js",
      "_vue-router-oFY6fX0y.js",
      "_contact_info-qI9Vj_GE.js"
    ],
    "css": [
      "assets/annuaire-BD7dvoKS.css"
    ]
  },
}

django-vite-plugin has no problem to add the related css file (annuaire-BD7dvoKS.css in this case). But when it comes to recursively find other css imports menu_bar-B1DNQiR2.css for instance from _menu_bar-Cg_ihQeU.js, it fails since the function _get_css_files in utils.py should have a manifest_entry Dict and not a path. This PR fix this.

@protibimbok protibimbok merged commit ca25423 into protibimbok:master Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants