Developer forum

Forum » Swift » Build error on htmx.js

Build error on htmx.js

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

Without changes to our build  we suddently get build errors from NPM on the library htmx:

  [3] ./node_modules/htmx.org/dist/htmx.min.js 424 bytes {2} [built] [failed] [1 error]

  ERROR in ./node_modules/htmx.org/dist/htmx.min.js 1596:21
    Module parse failed: Unexpected token (1596:21)
    File was processed with these loaders:
     * ./node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.
    |     function Ct(t, e, r) {
    |       var n = Y(t);
    >       n.onHandlers ||= {};
    |       var i = new Function("event", r + "; return;");
    |       var a = t.addEventListener(e, function (e) {
     @ ./Swift/Files/Templates/Designs/Swift/Assets/_src/js/modules/htmx.js 1:0-33 2:14-18

 

Has anyone seen this before? Is it maybe bringing in a new, incompatible version of htmx? Do I need this library at all?

Thanks!

Imar

 


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

It turns out that a new version of htmx exists which breaks the build. The solution is to update the package.json file dependencies in the files project with the following "htmx.org": "1.8.4", this will make it use exactly version 1.8.4 and not the latest. 

Imar

Votes for this answer: 1
 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Imar,

Thanks for posting this, I just ran into the issue too and this has saved me some Alice in Wonderland moments :-)

As a sidenote, I think htmx is used for the filter functionality of the Articles lists...

Justin

 
Daniel Voicu
Daniel Voicu
Reply

Hi,

Is using this library a sign of things to come? This looks like a new set of conventions and a fringe library with its own way of doing things to achieve something basic that can even include async/await, in this case, if it was written in the .js file. You can not solve everything by putting attributes on the element with inherent automation and even if you can achieve something simple like a XHR request, there is a lot of customization and JS used after that in most cases with its own particularities based on the context of that action. 

What killed the Rapido Blocks(I hope), was the inherent uncommon conventions for developers and lack of visibility, flexibility, compossibility. That philosophy seems to have not died out completely in adding this little library. Using this little library is not future proofing the implementation but adding little quirks with little to no gains at all in speed, readability and future customization. This looks disheartening.

 

You must be logged in to post in the forum