Build does not use my configuration file (11ty js)

In the Kinsta build logs, liquid files are being built, but in my configuration file, I have set the template formats to md, njk, and html.

This leads me to think that my configuration file is not being read in the build process.

I have tried to run npx @11ty/eleventy --config=eleventy.config.js and npx @11ty/eleventy --config=./eleventy.config.js but both deploys failed with a file not found error.

Build settings

  • command: npx @11ty/eleventy

  • Node version: 20

  • Root directory: src

  • Publish directory: _site

That produce the following logs:

...

Apr 18 20:19:36 🛠️ Running build command: npx @11ty/eleventy

Apr 18 20:19:36

Apr 18 20:19:37 [11ty] Writing ./_site/admin/index.html from ./admin/index.html (liquid)

Apr 18 20:19:37 [11ty] Writing ./_site/index.html from ./index.md (liquid)

Apr 18 20:19:37 [11ty] Wrote 2 files in 0.14 seconds (v3.0.0)

Apr 18 20:19:37

Apr 18 20:19:37 ✅ Build command succeeded

Apr 18 20:19:37

Apr 18 20:19:38 🚀 Publishing '_site' directory...

...

eleventy config

// eleventy.config.js  <-Located at the root of the project
const fs = require("fs");
const path = require("path");

module.exports = function(eleventyConfig) {

    // Set directories
    eleventyConfig.addPassthroughCopy("src/css");
    eleventyConfig.addPassthroughCopy("src/imgs");

    // Add admin directory decap
    eleventyConfig.addPassthroughCopy("admin");

    eleventyConfig.addCollection("galleryImages", function(collectionApi) {
        const dir = "src/imgs/gallery";
        return fs.readdirSync(dir)
          .filter(file => /\.(jpg|jpeg|png|gif)$/i.test(file))
          .map(file => ({
            src: `imgs/gallery/${file}`,
            alt: path.parse(file).name
          }));
      });
    return {
        dir: {
            input: "src",
            includes: "_includes",
            data: "_data",
            output: "_site"
        },
        // Add template formats
        templateFormats: ["md", "njk", "html"],
        // Add markdown plugins
        markdownTemplateEngine: "njk",
        htmlTemplateEngine: "njk",
        dataTemplateEngine: "njk",
        // Add passthrough file copy
        passthroughFileCopy: true
    };
};

I have been able to successfully build locally and on netlify. Both show pass through files being copied and nunchucks being written. I’m omitting them 'cause this post is already pretty long.

Any help would be appreciated, thank you very much for your time.

Hi BoxOfCereal, and welcome to the community forum!

Thanks for posting the detailed information about the issue you’re encountering with your Eleventy build on our Application Hosting. I see you’ve correctly identified that Eleventy seems to be ignoring your eleventy.config.js file, evidenced by it processing Liquid templates instead of just the Markdown, Nunjucks, and HTML formats you specified. I also appreciate you sharing the troubleshooting steps you took with the --config flag.

Based on your description and settings, I think the most likely reason for this behavior is the “Build path” setting within your Application’s Settings > Build Environment configuration here at Kinsta. Currently, you specified you have this set to src. This tells our build system to change into the src directory before running your build command (npx @11ty/eleventy).

Eleventy, by default, looks for its eleventy.config.js file in the directory where the build command is executed. Since the build command is running inside src (due to the Kinsta setting) but your configuration file is located at the project’s root (one level above src), Eleventy can’t find it. When it doesn’t find a configuration file, it falls back to its default settings, which include processing Liquid files. This also explains why using --config=./eleventy.config.js resulted in a ‘file not found’ error – it was correctly looking for the file inside the src directory, where it doesn’t exist.

The good news is that your eleventy.config.js file already correctly tells Eleventy where your input directory is (dir: { input: "src", ... }) relative to the project root. Therefore, Kinsta doesn’t need to force the build context into the src directory. You should adjust the Kinsta setting to allow Eleventy to run from the project root, where it can find its configuration.

Here’s how to adjust the setting:

  1. Log in to your MyKinsta dashboard.
  2. Navigate to your Application and go to the Settings section on the left sidebar.
  3. Find the Build Environment box and click the Update Settings button..
  4. Locate the Build Path field under the “Build Environment” pop up box.
  5. Set this field to .
  6. Click “Update”.
  7. Trigger a new deployment either by pushing a fresh commit to your repository or by going to the Deployments page and clicking “Deploy now”.

By making this change, the build command should run from the root of your repository. Eleventy will then successfully find your eleventy.config.js file, read your specified settings (like input: "src", output: "_site", and your desired templateFormats), and execute the build as you intend. Your build command (npx @11ty/eleventy) and ‘Publish directory’ (_site) settings look correct and should work perfectly once the build path is adjusted.

Please give that change a try and check the build logs on the next deployment. Let us know if that resolves the issue! If you still encounter problems, feel free to reply here with the latest logs, and we’ll be happy to investigate further.

You can also open up a chat with us in the MyKinsta interface for more interactive support.

1 Like

Thank you for thoroughly explaining what’s going on and where I went astray. I appreciate the long thought out of response especially on a holiday.

I’ll keep it brief so as not to take up any more of your time:

I followed your instructions and updated my build path to . and the site builds perfectly!

Thanks again! I really appreciate the help! I’m sorry it was something so simple. :sweat_smile:

Thanks for the follow up! I’m glad to hear it worked :slightly_smiling_face:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.