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

Browser-ready dist/ folder? #3

Closed
chriscalo opened this issue Nov 13, 2018 · 5 comments
Closed

Browser-ready dist/ folder? #3

chriscalo opened this issue Nov 13, 2018 · 5 comments

Comments

@chriscalo
Copy link

Any chance I can convince you to publish a browser-ready dist/ folder to npm? That makes it possible to use your library without a build step via unpkg.com, for example:

<script src="https://unpkg.com/regexr@1.3.0/dist/regexr.js"></script>
@trusktr
Copy link
Owner

trusktr commented Dec 3, 2018

@chriscalo Hello! Sounds good.

I do that with my latest libs, but at the time I didn't have the build setup that I share with my newer packages.

In the meantime, something like the following should work (haven't tested it):

<script>
  var module = { exports: {} }
  var exports = module.exports
</script>
<script src="https://unpkg.com/regexr@1.3.0/regexr.js"></script>

then r (or regexr) will be available as a global.

@trusktr
Copy link
Owner

trusktr commented Dec 3, 2018

Alright, done! Try the following:

<script src="https://unpkg.com/regexr@1.4.3/global.js"></script>
<script>
  const r = regexr.default // grab the default export from the global
  console.log(r`/foo/` instanceof RegExp) // true
</script>

@trusktr trusktr closed this as completed Dec 3, 2018
@trusktr
Copy link
Owner

trusktr commented Dec 3, 2018

Hmmm, wait, something didn't work as expected when I tested locally.

@trusktr trusktr reopened this Dec 3, 2018
@trusktr
Copy link
Owner

trusktr commented Dec 3, 2018

Alright fixed it in v1.4.4. Try:

<script src="https://unpkg.com/regexr@1.4.4/global.js"></script>
<script>
  const r = regexr.default // grab the default export from the global
  console.log(r`/foo/` instanceof RegExp)
</script>

@trusktr trusktr closed this as completed Dec 3, 2018
@chriscalo
Copy link
Author

Working for me. Thanks, @trusktr 🙏

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