Day 47 | Configure Webpack + Eleventy for Alpine.js + ava

21 July, 2020

Use quite some time figuring out Webpack for Alpine.js project due to the scope problem noted in Alpine.js:

For bundler users, note that Alpine.js accesses functions that are in the global scope (window), you'll need to explicitly assign your functions to window in order to use them with x-data for example window.dropdown = function () {} (this is because with Webpack, Rollup, Parcel etc. function's you define will default to the module's scope not window).

Back