nuxt-modules / algolia

πŸ”Ž Algolia module for Nuxt
https://algolia.nuxtjs.org/
MIT License
191 stars 35 forks source link

fix: don't import docsearch css for server build #89

Closed danielroe closed 2 years ago

danielroe commented 2 years ago

Types of changes

Description

See https://github.com/nuxt/nuxt.js/issues/14657.

These lines: https://github.com/nuxt-community/algolia-module/blob/449fceac98378c00f03f5ff92589a466ed83d356/src/runtime/components/AlgoliaDocSearch.vue#L63-L69

are transformed in the server build to

      const docsearch = await Promise.all([
        import(
          /* webpackChunkName: "docsearch" */
          "./_nuxt/index.d1f4b1da.js"
        ),
        import(
          /* webpackChunkName: "docsearch" */
          "./_nuxt/style.1f98b5b0.js"
        )
      ]).then(([docsearch2]) => docsearch2.default);

... but the css import (the second one) is not emitted in the server build.

Checklist:

netlify[bot] commented 2 years ago

Deploy Preview for nuxt-algolia-module canceled.

Name Link
Latest commit 449fceac98378c00f03f5ff92589a466ed83d356
Latest deploy log https://app.netlify.com/sites/nuxt-algolia-module/deploys/63035b480ead790008ab9d90
Baroshem commented 2 years ago

Thanks, @danielroe for this.

It will be indeed useful! Feel free to merge or give me a sign so I will merge it πŸ˜„

I will release it as a part of a new 1.2.0 version

danielroe commented 2 years ago

Go for it.