Skip to content

Module "crypto" has been externalized for browser compatibility on v0.39 upgrade #1649

Closed
@brunoocasali

Description

@brunoocasali

Issue:

While upgrading to v0.39.0 you may see this error:

[plugin:vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by ".../meilisearch-js-plugins/node_modules/meilisearch/dist/bundles/meilisearch.esm.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

It means you're probably using the Vue 3 and Vite like our instant-meilisearch playground.

Solution:

To fix this warning and to be able to build your app just add this to the config file:

export default defineConfig({
  plugins: [vue()],
  build: {
    rollupOptions: {
      external: ['crypto'], // this is the important part
    },
  },
})

Otherwise, you'll face errors like Module "crypto" has been externalized for browser compatibility.

Original error: https://github.com/meilisearch/meilisearch-js-plugins/actions/runs/8970098117/job/24632854404?pr=1294

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions