eleventy-load Lightning

Bundle JavaScript with webpack

Add your script element as usual, with a src attribute. The JavaScript will be bundled with webpack using eleventy-load-js.

<script src="index.js"></script>
module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(require("eleventy-load"), {
    rules: [
      {
        test: /\.(md|html)$/,
        loaders: [
          {
            loader: require("eleventy-load-html"),
          },
        ],
      },
      {
        test: /\.js$/,
        loaders: [
          {
            loader: require("eleventy-load-js"),
          },
          {
            loader: require("eleventy-load-file"),
          },
        ],
      },
    ],
  });
};