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

feat(build): add index files to bundles #223

Merged
merged 1 commit into from
Nov 10, 2019
Merged

Conversation

Thomaash
Copy link
Member

This allows more visually appealing imports when used with bundlers:

// Old, but still works:
import * as vis from "vis-network/standalone/esm/vis-network";

// New, achieving the same result (ESM):
import * as vis from "vis-network/standalone";

// ESM explicitly:
import * as vis from "vis-network/standalone/esm";

// UMD explicitly:
import * as vis from "vis-network/standalone/umd";

This partially works in HTML but the old way is preferred (less requests,
library name in dev tools and better compatibility):

<!-- Old, still works. Recommended. -->
<script
  type="text/javascript"
  src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
></script>

<!-- New, works but has issues. Not recommended. -->
<script
  type="module"
  src="https://unpkg.com/vis-network/standalone/esm"
></script>

<!-- New, doesn't work. -->
<script
  type="text/javascript"
  src="https://unpkg.com/vis-network/standalone/umd"
></script>

This allows more visually appealing imports when used with bundlers:
```typescript
// Old, but still works:
import * as vis from "vis-network/standalone/esm/vis-network";

// New, achieving the same result (ESM):
import * as vis from "vis-network/standalone";

// ESM explicitly:
import * as vis from "vis-network/standalone/esm";

// UMD explicitly:
import * as vis from "vis-network/standalone/umd";
```

This partially works in HTML but the old way is preferred (less requests,
library name in dev tools and better compatibility):
```html
<!-- Old, still works. Recommended. -->
<script
  type="text/javascript"
  src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"
></script>

<!-- New, works but has issues. Not recommended. -->
<script
  type="module"
  src="https://unpkg.com/vis-network/standalone/esm"
></script>

<!-- New, doesn't work. -->
<script
  type="text/javascript"
  src="https://unpkg.com/vis-network/standalone/umd"
></script>
```
@Thomaash Thomaash requested a review from a team November 10, 2019 13:24
@yotamberk yotamberk merged commit c4ff269 into master Nov 10, 2019
@yotamberk yotamberk deleted the better-node-imports branch November 10, 2019 19:22
@vis-bot
Copy link
Collaborator

vis-bot commented Nov 10, 2019

🎉 This PR is included in version 6.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants