lundi 22 juin 2020

How to test if library imports correctly in different environments

I want to try out all my bundles in their respective environments.

I created an API wrapper that I bundled in different formats:

  • cjs
  • esm
  • iife

I had some trouble making them all be properly imported on their respective environment.

I would like to add some tests to be sure that they are properly imported.

This is one of the example that I have difficulties knowing how to test:

<script src="../../dist/bundles/mywrapper.umd.js"></script>
<script>
  const client = new window.MyWrapper({
    host: 'localhost'
  })
  client.someFunction.then(res => {
    console.log({ res });
  })
</script>

For the moment I manually open the index.html file and look at the console.

Aucun commentaire:

Enregistrer un commentaire