Coder Social home page Coder Social logo

htmx.logAll is not a function about htmx HOT 4 CLOSED

anentropic avatar anentropic commented on August 27, 2024
htmx.logAll is not a function

from htmx.

Comments (4)

anentropic avatar anentropic commented on August 27, 2024

so if I log what htmx is in the event handler...

when imported as import htmx from 'htmx.org'; then:
Screenshot 2024-06-21 at 14 22 39

as import * as htmx from 'htmx.org';:
Screenshot 2024-06-21 at 14 23 49

as import { htmx } from 'htmx.org';:
undefined

if I just import 'htmx.org'; then VS Code inteliisense will prompt me with htmx.logAll() as if it would work, but at runtime it gives ReferenceError: htmx is not defined

from htmx.

anentropic avatar anentropic commented on August 27, 2024

Is it this? #1690 #1469

they are all talking about HTMX Extensions but sounds related

from htmx.

anentropic avatar anentropic commented on August 27, 2024

ah..! here #2628

if I do this in index.js:

import htmx from "htmx.org/dist/htmx.esm";
window.htmx = htmx;

then the body script works:

      <script>
        document.body.addEventListener('htmx:load', function (evt) {
          htmx.logAll();
        });
      </script>

(seems like nothing else is required for this much to work, no separate js file, no rollup plugin etc etc)

from htmx.

Telroshan avatar Telroshan commented on August 27, 2024

Hey, sorry for the inconvenience, as 1cg stated in the issue you linked

entirely possible that those instructions are wrong now, unfortunately, since no one on the core team that I'm aware of uses webpack

We'll have to update those to match htmx 2's new setup!

Closing this issue in favor of #2628

from htmx.

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.