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

missing library? #28

Closed
dackdel opened this issue Oct 24, 2020 · 2 comments
Closed

missing library? #28

dackdel opened this issue Oct 24, 2020 · 2 comments

Comments

@dackdel
Copy link

dackdel commented Oct 24, 2020

cannot find 'dist/esm.js' or am i missing something :P
Screenshot-20201025035334-448x151

@dackdel
Copy link
Author

dackdel commented Oct 24, 2020

also link to the unpkg.com file in demo example works when i paste it in the browser but not when i try to run locally. had to copy paste replace https://unpkg.com/permutable@0.2.19/dist/esm.js?module with this destination link?

@danielmahal
Copy link
Contributor

Yes, you are right, this is poorly documented.

So, JavaScript has many different ways of defining modules.

Permutable is compiled in three different ways:

  • esm (modern way)
  • iife (old-school way)
  • commonjs (node.js/webpack/browserify etc.)

This let's you use Permutable in different development environments.

The recommended way of using Permutable is with esm. Sadly, it does not work with the file:// protocol, so you have to do your local development through a development server so it's loaded through http://. Any server which serves the files statically should work here.

If you don't want to use a development server, you could use the old-school iife version. It works with the file:// protocol. It would go something like this:

<script src="https://unpkg.com/permutable@0.2.21/dist/iife.js"></script>
<script type="module">
  permutable.run({
    // ...
  })
</script>

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

No branches or pull requests

2 participants