How to integrate a Nuxt3 SPA into a Drupal site

31 Views Asked by At

I created a Nuxt 3 application hosted on Firebase which works well.

Now I would like to integrate it with my Drupal site. I made a test application with these options to obtain an SPA :

ssr:false
hashMode: true

I created a module to have a page with a specific template that will host my SPA. In the template, I suppose it needs something like:

<div id="__nuxt" data-v-app></div>

And to integrate the JS file(s) of the build I can do it with: hook_page_attachments or hook_page_bottom

What I don't understand is what files and folders I should put in the js folder of my Drupal module. And which files I should indicate to hook_page_attachments or hook_page_bottom

Here is the structure of the .output folder after npm run build:

.output
  public
    _nuxt
      builds
        ...
      entry.a6c43c85.js
      error-404.7fc72018.css
      error-404.9c7c2d68.js
      error-500.c5df6088.css
      error-500.e7ee99e7.js
      index.c71120d1.js
      login.5b440203.js
      nuxt-link.ddc76388.js
      vue.f36acd1f.ed6b2477.js
      favicon.ico
  server
    ...
  {} nitro.json

(What is the server folder for my SPA?)

Thanks for your help

0

There are 0 best solutions below