Static GitHub Issues

[3249] Add preload tags dynamically.

prev: How to set rootDir as ~
next: ES2015+ modules with a fallback to legacy bundle

I can not create the issue using https://nuxtjs.cmty.io/issues/new <-- the page doesn't work.

Is it possible to inject the webpack bundled javascript file names into nuxt context? I can see I have access to it in this hook:

nuxt.hook('render:resourcesLoaded', (resources) => { if (resources && resources.clientManifest && resources.clientManifest.async) { asyncJavacriptChunksMap = resources.clientManifest.async; console.log(asyncJavacriptChunksMap);

prints -> 'Images.js', 'CheckoutSender.js', 'CheckoutOrderOverview.js', 'CheckoutReceipt.js', 'CheckoutPaymentDetails.js', 'CheckoutDeliveryDetails.js', 'ProductDetailsOverview.js',

In production the hash values are included. In our solution we use asynch components like this: components: { ProductSlider: () => import(/ webpackChunkName: "ProductSlider" /'~compositions/ProductSlider'), OccasionSlider: () => import(/ webpackChunkName: "OccasionSlider" /'~compositions/OccasionSlider'), HeroBanner: () => import(/ webpackChunkName: "HeroBanner" /'~components/Hero'), Textbox: () => import(/ webpackChunkName: "Textbox" /'~components/Textbox'), Splitview: () => import(/ webpackChunkName: "Splitview" /'~compositions/Splitview'),

I can see nuxt out of the box only adds the scripts as prefetch. The modules are rendered in a dynamic component based on cms data.

<template v-if="modules"> <component v-for="(item, index) in modules" v-if="hasContentAndType(item)" :is="item.type" :content="item" :key="index"></component> </template>

I would like to add preload link tags as well as http2 Link tag assets based on the modules that are turned on for a page in our cms. Do you know any way this is possible? Or can I request this feature?

If i can somehow add the resources map to nuxt context I think I can solve it from there.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c6937">#c6937</a>)</em></sub></div>