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

Add usage way for browser projects without require #244

Closed
maximzasorin opened this issue Jan 7, 2018 · 7 comments
Closed

Add usage way for browser projects without require #244

maximzasorin opened this issue Jan 7, 2018 · 7 comments

Comments

@maximzasorin
Copy link

For example with unpkg.com:

<script src="https://unpkg.com/qs/dist/qs.js"></script>
<script>
Qs.parse(location.search.substring(1));
</script>
@ljharb
Copy link
Owner

ljharb commented Jan 7, 2018

No thanks. Every JS project should only be consumable via npm and a build process; eg browserify or webpack, otherwise you can’t make use of modules.

There’s https://wzrd.in if you’re stuck on legacy architecture.

@ljharb ljharb closed this as completed Jan 7, 2018
@fritx
Copy link

fritx commented Jan 30, 2019

@ljharb I was +1 on your view, so my library vue-at, vue-threejs were all released just in commonjs.

However, these days I changed my mind:

With a umd / unpkg.com bundle, I'm able to make up a codepen demo with no required "architecture" like webpack or browserify.

I've just published vue-threejs in umd mode along with commonjs.

Here's some of my fresh demos, benefit from umd / unpkg.com mode:

Three.js with physical effects writen in Vue
https://codepen.io/fritx/project/editor/AoLRoy

Spaceship and ocean animated in Vue
https://codepen.io/fritx/pen/KJMprm

ref: fritx/vue-threejs#8 (comment)

@fritx
Copy link

fritx commented Jan 30, 2019

<script src="https://unpkg.com/qss"></script>

For now I switch to qss which supports umd

@ljharb
Copy link
Owner

ljharb commented Jan 30, 2019

I will definitely agree that "codepen"-style demos is a valid use case.

Note that qs already has one of these, and always has: https://unpkg.com/qs@6.6.0/dist/qs.js but i'm going to remove it for v7.

@fritx
Copy link

fritx commented Jan 31, 2019

@ljharb sorry didn't noticed that (dist/qs.js), I was just visiting https://unpkg.com/qs and receiving a commonjs.

How about adding a unpkg field in package.json pointed to dist/qs.js?

@ljharb
Copy link
Owner

ljharb commented Jan 31, 2019

What tools look at that field? It’s not good for the ecosystem to just litter package.json with random fields.

@fritx
Copy link

fritx commented Feb 1, 2019

@ljharb it works, I just saw other people using that field, and I tried it in vue-threejs, and then https://unpkg.com just could link to that file automatically.

Try https://unpkg.com/vue-threejs, and it should link to ./lib/VueThreejs.umd.min.js

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

3 participants