baconjs / bacon.js

Functional reactive programming library for TypeScript and JavaScript

Home Page:https://baconjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide Aggregated ES Module?

semmel opened this issue · comments

While it's easy to "import" dist/Bacon.js in a web page using an AMD loader or simply via <script> tag, there is no distribution file for importing as ES module:
import * as Bacon from "../dist/.Bacon.mjs" requires transpiling and bundling from the original sources - npm install baconjs is insufficient.
Could such an aggregated ES module file not be generated in scripts/assemble.js by rollup?

import typescriptPlugin from 'rollup-plugin-typescript2';

const
  config = {
    input: './src/bacon.ts',
    output: {
      format: "esm",
      file: "./dist/Bacon.mjs"  // <-- or whatever name
    },
    plugins:[
      typescriptPlugin({
        typescript: require("typescript"),
        useTsconfigDeclarationDir: true
      })
    ]
  };
  export default config;

It would certainly help with "build-step free" development in the browser.