You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating a three.js loader, but there's a lot of sweet stuff from npm which I'd really like to leverage. Since I want as few dependencies as possible it would seem the best approach would be to use ES6 export / import, but that doesn't seem to be possible currently. I understand that the current system makes that hard, but it would seem like the generated format lends itself to just add a root level script at the bottom. The generated function would wrap up all the scripts as it currently does, but doesn't insert the code for the root script, instead it wraps the require function with the root module to module-id mappings which previously was inserted straight into the wrapping function, and returns that wrapped assigned to require. Super confusing, but essentially a bundle file would look like:
// Something which looks very close to what's currently being generated, but instead assigned to require
let require = (function () { function r(e, n, t) { ... },{},[]);
// Root level can now use require as per usual & create an exposed API which can be imported
let some_dep = require('some-dependency');
function foo_using_dep( arg ) { ... }
function bar_using_dep( arg ) { ... }
export { foo_using_dep, bar_using_dep };
Would there be any demand for such a feature or am I perhaps missing something? I'm far from an expert on neither javascript nor node.
The text was updated successfully, but these errors were encountered:
I'm creating a three.js loader, but there's a lot of sweet stuff from npm which I'd really like to leverage. Since I want as few dependencies as possible it would seem the best approach would be to use ES6 export / import, but that doesn't seem to be possible currently. I understand that the current system makes that hard, but it would seem like the generated format lends itself to just add a root level script at the bottom. The generated function would wrap up all the scripts as it currently does, but doesn't insert the code for the root script, instead it wraps the require function with the root module to module-id mappings which previously was inserted straight into the wrapping function, and returns that wrapped assigned to require. Super confusing, but essentially a bundle file would look like:
Would there be any demand for such a feature or am I perhaps missing something? I'm far from an expert on neither javascript nor node.
The text was updated successfully, but these errors were encountered: