Description:
I'm trying to use htmx-json in a modern ES Modules setup (Webpack) with npm-installed packages.
Steps to reproduce:
- Install the packages:
npm install htmx.org htmx-json
- Import them like this:
import 'htmx.org';
import 'htmx-json';
- Run the project.
Expected behavior:
The htmx-json extension should work and provide attributes like json-text, json-each, etc.
Actual behavior:
The extension does not work. It seems that htmx-json cannot find the global htmx variable, which is not automatically exposed in ES module environments.
Temporary workaround that works:
import htmx from 'htmx.org';
// Make htmx global
window.htmx = htmx;
Promise.all([
import('htmx-json'),
]).then(() => {
console.log('All extensions loaded');
});
Description:
I'm trying to use
htmx-jsonin a modern ES Modules setup (Webpack) with npm-installed packages.Steps to reproduce:
Expected behavior:
The htmx-json extension should work and provide attributes like json-text, json-each, etc.
Actual behavior:
The extension does not work. It seems that htmx-json cannot find the global htmx variable, which is not automatically exposed in ES module environments.
Temporary workaround that works: