a pure es module import would be fantastic
See original GitHub issueI frequently like to use dat.gui in small experiments on my local machine. I’d love to not need to have a package manager to install/build/configure dat.gui for these fast experiments.
Here is how I’d like to use dat.gui:
<script type="module">
import dat from 'https://cdn.jsdelivr.net/gh/dataarts/dat.gui@0.7.7/src/dat/index.js'
const obj = { x: 40, y: 100 }
const gui = new dat.GUI()
gui.add(obj, 'x')
gui.add(obj, 'y')
</script>
Right now this snippet won’t work because the source code doesn’t include the file extension when it imports modules (.js
)
This would be really amazing for prototyping, just being able to wire up this usage of dat.gui without all the ceremony of needing node, npm, bundling tools, bundling config, etc.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Import ES module in Next.js ERR_REQUIRE_ESM
I think the problem is that Webpack (or Babel) is transforming all import s to require() s but ky is a pure ES...
Read more >Publishing NPM Packages as Native ES Modules - Medium
Basically, for tree shaking to work with webpack, you must be using es imports and exports, and your code must consist of pure...
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
ESM scripts can import CJS scripts, but only by using the “default import” syntax import _ from 'lodash' , not the “named import”...
Read more >How to Dynamically Import ECMAScript Modules
ECMAScript (aka ES2015, or ES) modules are a way to organize cohesive ... Because the import(path) returns a promise, it fits great with...
Read more >Alternatives to __dirname in Node.js with ES modules
ES modules with Node.js add a new, standardized global that allows your code to run anywhere, locally or remotely.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I’m not asking anyone to drop backwards compatibility. 😃 I’m just asking if we could provide a “pure” es modules based thing alongside all of our existing stuff, which would enable me to drop node/npm/package.json/build tools/legacy module formats, etc.
with the advent of good browser support + deno, now seems like a prime time to start re-evaluating the way we’ve been doing things for the last decade of javascript.
sounds reasonable, thanks for your time!