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

Remove not working umd bundle and replace with iife and cjs #471

Merged
merged 6 commits into from
Jun 24, 2020

Conversation

bidoubiwa
Copy link
Contributor

@bidoubiwa bidoubiwa commented Jun 22, 2020

How to import MeiliSearch

Node - CommonJs

const MeiliSearch = require('meilisearch')

Browser - vanilla JS

<script src="https://cdn.jsdelivr.net/npm/meilisearch@latest/dist/bundles/meilisearch.browser.js"></script>
<script>
  const client = new MeiliSearch({
    host: 'http://127.0.0.1:7700',
    apiKey: 'masterKey',
  })
  client.listIndexes().then(res => {
    console.log({ res });
  })
</script>

EcmaScript module - esm

import MeiliSearch from 'meilisearch'

Important, if your bundler uses browser as primary entry key, please change it to module.
Example in webpack:

resolve: {
    mainFields: ["module", "browser"] // the `module` field has priority on the browser field
  },

EcmaScript module Typescript - esm

import MeiliSearch, { Index, SearchResponse } from 'meilisearch'

Fixes in this PR

Remove overwrite cjs in umd

Added in this PR

Examples in the following environments:

  • browser - vanilla JS
  • node
  • typescript front end
  • typescript back end

fixes: #466 #470

Remove unecessary configs

Examples

comment removed

Add version

remove version

Information on imports
@bidoubiwa bidoubiwa requested a review from curquiza June 22, 2020 17:48
@bidoubiwa bidoubiwa marked this pull request as ready for review June 22, 2020 17:48
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I trust you for the rollup.config.js 😂

Good job 👍

@bidoubiwa bidoubiwa merged commit 02aab14 into master Jun 24, 2020
@bidoubiwa bidoubiwa deleted the umd_import branch June 24, 2020 16:39
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.

Multiple issues when using umd file
2 participants