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

Per file module output #408

Closed
5 tasks done
bryanjos opened this issue Sep 12, 2017 · 3 comments
Closed
5 tasks done

Per file module output #408

bryanjos opened this issue Sep 12, 2017 · 3 comments

Comments

@bryanjos
Copy link
Collaborator

bryanjos commented Sep 12, 2017

Output currently is one bundled ES module file. This is a proposal to have each Elixir module translate to a JavaScript module.

  • The Core js file should be in the output
  • Elixir module translate to a JavaScript module
  • Each module should import the Core js file
  • All the modules that a module uses would have to be tracked and imported in the module's js file
  • Correct output of protocols and their implementations would have to be figured out

Note: this would make it much more difficult to include a bundled file. Luckily in environments where ES modules are supported, it may not be as big of an issue.

Note 2: Much less changes would be needed if dynamic import was supported and ElixirScript compiled to async functions. This may be a future enhancement.

@vans163
Copy link
Contributor

vans163 commented Sep 12, 2017

Is there nothing like UMD for ES6? Where you can just simply concat sources ontop of eachother then run a minifier on it?

I guess with the module system SE6 has and having to explicitly import everything, things become tedious.

From my understanding you can still generate the "main module" that imports all functions from all the compiled es6 modules and exports them? The complication comes when you want to minify it all into 1 release.js? Perhaps ES6 toolchain has that?

@OvermindDL1
Copy link

Perhaps ES6 toolchain has that?

Rollup.js

@bryanjos
Copy link
Collaborator Author

Rollup was my first thought and something ElixirScript uses already. But that's during ElixirScript's development and in this case it would need to be during it's use in projects. If ElixirScript takes advantage of elixir_v8 or something else, Rollup would be my first choice

@bryanjos bryanjos self-assigned this Oct 21, 2017
@bryanjos bryanjos added this to the 0.32.0 milestone Oct 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants