Giter Site home page Giter Site logo

ES Module Support about brunch HOT 10 OPEN

Jesspu avatar Jesspu commented on June 2, 2024
ES Module Support

from brunch.

Comments (10)

Jesspu avatar Jesspu commented on June 2, 2024 2

from brunch.

Jesspu avatar Jesspu commented on June 2, 2024 1

Very cool, thanks for sharing.

I am actually close to porting brunch itself to an ES module. That will allow it to use CJS and ESM packages throughout without any issues.

Once it's done and validated, I will share it as well. It will also be shipped to the @firstfleet/brunch npm package (fork of brunch that currently has my esm plugin support).

I hope this will at least future proof brunch a bit so I can keep using it.

from brunch.

reubano avatar reubano commented on June 2, 2024 1

Cool! I'm sure they'd appreciate a PR over here too.

from brunch.

paulmillr avatar paulmillr commented on June 2, 2024 1

@reubano hard to do find more time being at war, but I also want to keep Brunch up and running. Just need more help.

from brunch.

reubano avatar reubano commented on June 2, 2024 1

@reubano hard to do find more time being at war, but I also want to keep Brunch up and running. Just need more help.

Thoughts and prayers to you and yours!! 🙏🏽

from brunch.

paulmillr avatar paulmillr commented on June 2, 2024

Hey @Jesspu

Thanks for the kind words! Unfortunately i'm focusing on other projects at the moment, and there is no space for Brunch. You can consider it deprecated. Unless someone wants to contribute.

I'd keep this issue open in any case.

from brunch.

Jesspu avatar Jesspu commented on June 2, 2024

Okay, no problem appreciate your response and all the work on brunch over the years.

We are actually still using brunch for our new frontend apps built in svelte, and it works great. I have had to maintain most of our plugins, but with the way brunch is set up, it is pretty trivial.

Sad that the sun is setting on brunch, but I will probably keep using it until I am no longer able to do so.

If anyone else finds this issue, and has questions about converting brunch plugins to ESM, or using ESM in brunch, let me know and I will try to help.

from brunch.

reubano avatar reubano commented on June 2, 2024

Here's how I handled it for @observablehq/plot. Ugly, but works...

package.json

{
  ...
  "dependencies": {
    "@babel/runtime": "^7.7.4",
    "@observablehq/plot": "^0.4.2",
    "@popperjs/core": "^2.10.1",
    "bootstrap": "^5.1.0",
    "brunch": "^4.0.0",
    "coffeescript": "^2.5.1",
    "lodash": "^4.17.21",
    "mithril": "^2.0.4",
  },
  "devDependencies": {
    "@babel/core": "^7.17.8",
    "@babel/plugin-transform-runtime": "^7.17.0",
    "@babel/preset-env": "^7.16.11",
    "auto-reload-brunch": "^2.7.1",
    "babel-brunch": "^7.0.1",
    "clean-css-brunch": "^3.0.0",
    "coffee-script-brunch": "^4.0.0",
  }
}

brunch-config.js

// Generated by CoffeeScript 2.4.1

module.exports = {
  // http://brunch.io/docs/config
  plugins: {
    babel: {
      presets: ['@babel/preset-env'],
      plugins: [
        [
          "@babel/plugin-transform-runtime",
          {
            "absoluteRuntime": false,
            "version": "^7.7.4"
          }
        ]
      ],
      ignore: [
        /^node_modules\/bootstrap/,
        /^node_modules\/mithril/,
        /^node_modules\/lodash/,
        /^node_modules\/@babel\/runtime/,
      ]
    }
  },
  npm: {
    compilers: ['babel-brunch'],
    globals: {
      popper: "@popperjs/core",
      _: "lodash",
      Plot: "@observablehq/plot",
      babelInteropRequireDefault: "@babel/runtime/helpers/interopRequireDefault",
      babelGet: "@babel/runtime/helpers/get",
      babelInherits: "@babel/runtime/helpers/inherits",
      babelSlicedToArray: "@babel/runtime/helpers/slicedToArray",
      babelObjectSpread2: "@babel/runtime/helpers/objectSpread2",
      babelClassCallCheck: "@babel/runtime/helpers/classCallCheck",
      babelCreateClass: "@babel/runtime/helpers/createClass",
      babelPossibleConstructorReturn: "@babel/runtime/helpers/possibleConstructorReturn",
      babelGetPrototypeOf: "@babel/runtime/helpers/getPrototypeOf",
      babelObjectWithoutProperties: "@babel/runtime/helpers/objectWithoutProperties",
      babelToConsumableArray: "@babel/runtime/helpers/toConsumableArray",
      babelAssertThisInitialized: "@babel/runtime/helpers/assertThisInitialized",
      babelDefineProperty: "@babel/runtime/helpers/defineProperty",
      babelInteropRequireDefault: "@babel/runtime/helpers/interopRequireDefault",
      babelTypeof: "@babel/runtime/helpers/typeof",
      babelWrapNativeSuper: "@babel/runtime/helpers/wrapNativeSuper",
      babelRegenerator: "@babel/runtime/regenerator",
      bootstrap: "bootstrap",
    }
  },
  server: {
    hostname: "0.0.0.0",
    port: 3333
  },
  files: {
    javascripts: {
      joinTo: {
        "javascripts/app.js": /^app/,
        "javascripts/vendor.js": /^(?!app)/
      }
    },
    stylesheets: {
      joinTo: {
        "stylesheets/app.css": /^app\/.*custom\.css/,
        "stylesheets/vendor.css": /^(?!app)/
      }
    }
  },
  modules: {
    autoRequire: {
      "javascripts/app.js": ["initialize"]
    }
  },
  sourceMaps: "absoluteUrl"
};

view.coffee

m = require 'mithril'

module.exports =
  oncreate: (vnode) ->
    attrs = vnode.attrs
    data = attrs.collection.list

    graph = Plot.plot
      y: {grid: true}
      marks: [Plot.line(data, {x: "date", y: "value"})]

    vnode.dom.appendChild graph

  view: (vnode) -> m 'span.chart'

from brunch.

reubano avatar reubano commented on June 2, 2024

BTW @paulmillr, really hope you get more time for brunch. Don't know what I'd do if I was forced to go back to rollup or Webpack.

from brunch.

boehs avatar boehs commented on June 2, 2024

Just stumbled upon brunch, I also really want it to stay alive. Anything the community can do?

@paulmillr, do stay safe!

from brunch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.