Giter Club home page Giter Club logo

Comments (7)

marcinkoziej avatar marcinkoziej commented on June 10, 2024

Oh no!

I was also looking at Rollup which seems to be pretty modern and also has an API: https://rollupjs.org/guide/en/#rolluprollup

For example, maybe we could build the bundle by passing separately such entry points:

  • src/index.js
  • any portal files
  • any journey step components
  • the config json

We would not generate src/actionPage.js as with webpack, instead we would just tell rollpack which files to add, and each of them would store the component in a global window.proca.components.Register etc; Then in src/components/Widgets.js we would read the global window.proca.config and window.proca.components.X .
Right now it's also dynamic, but uses config to read the steps variable which is imorted from actionPage.js

Actually I am not sure why we did not consider this - passing the dynamic "imports" via window and not hacking the builder to generate a "static" imports...

I mean, in each step component we can do:

window.proca.components.Share = Share;

instead of

module.exports = {Share}

Quite similar no? :P

from proca.

tttp avatar tttp commented on June 10, 2024

When I looked at rollup, I didn't find options to build a module (proca), or to generate a single js file, but admittedly, I didn't look too long.

Some components are sometimes used directly (eg Register) or as a sub component (eg Petition or Email), how would it work?

coming back to the need: having a simple <script src=widget_name async></script> that:

  • create a global.proca that contains various functions (go, set...)
  • build the widget (equivalent of proca.go() )

build the widget has a bunch of modes:

  • put the widget where the <script> is (default)
  • put the widget where class="proca-widget" is (if exists)
  • if proca-widget contains some content, put it as a left hand column and the widget on the right hand column
  • delay the display (eg to deal with re-hydratation)
  • wait for proca.go to display (more advanced interface)

we also build the index.html page (can use different template set in the config, eg eci vs "normal") so we have a preview (convenient for demo/debug)

and a nice dev mode that automatically reloads when the code is changed.

if we could skip the webpack monstrosity and achieve all of that, it would be awesome!

from proca.

marcinkoziej avatar marcinkoziej commented on June 10, 2024

Some components are sometimes used directly (eg Register) or as a sub component (eg Petition or Email), how would it work?

For sure components are just functions so you could even write <window.proca.components.Register /> as I understand it

from proca.

marcinkoziej avatar marcinkoziej commented on June 10, 2024

we also build the index.html page (can use different template set in the config, eg eci vs "normal") so we have a preview (convenient for demo/debug)

Does it have to be built? (how much changes there? ) or could we just reuse one written by hand? (I am asking for case where the builder would just output Js, not JS+ html..)
As for outputs, what else do we need? map file? what else?

from proca.

tttp avatar tttp commented on June 10, 2024

from proca.

tttp avatar tttp commented on June 10, 2024

For sure components are just functions so you could even write <window.proca.components.Register /> as I understand it

almost: react adds a bunch of constraints on the function name (eg if should start with an uppercase), but

const Register = global.proca.component.Register would allow to <Register />.

this being said, we can probably keep both the export and the global.proca.component.xxx

from proca.

tttp avatar tttp commented on June 10, 2024

After further tests, moved to esbuild, good feature set and magic fast

from proca.

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.