Skip to content

Per file module output #408

Closed
Closed

Description

@bryanjos

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.

Activity

  1. vans163 commented on Sep 12, 2017

    @vans163
    Contributor

    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?

  2. OvermindDL1 commented on Sep 12, 2017

    @OvermindDL1

    Perhaps ES6 toolchain has that?

    Rollup.js

  3. bryanjos commented on Sep 12, 2017

    @bryanjos
    CollaboratorAuthor

    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

  4. self-assigned this
    on Oct 21, 2017
  5. added this to the 0.32.0 milestone on Oct 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions