Closed dajuno closed 2 years ago
This is a sort of an interesting one in that the version used by the config and what is used internally in your project i.e your .eleventy.js
file, will be whatever version is specified as a dependency and installed in your node_modules
. But the actual building/generating will happen with the version defined in npx
.
This can be viewed by adding a piece of global data to your .eleventy.js
that returns the version used by the config.
const Eleventy = require("@11ty/eleventy");
eleventyConfig.addGlobalData("config", () => {
return { version: Eleventy.getVersion() };
});
Then you can output both versions to check which version is used to build and which is used by the config.
<meta name="build.version" content="{{ eleventy.version }}">
<meta name="config.version" content="{{ config.version }}">
When this is generated you'll either see both versions matching or not. Using your reproduction steps to check, shows two mismatching versions.
<meta name="build.version" content="2.0.0">
<meta name="config.version" content="1.0.1">
This means that when your .eleventy.js
adds EleventyI18nPlugin
as a plugin, and tries to merge and process the plugin config it cannot. Because EleventyI18nPlugin
doesn't actually exist and is interpreted as undefined
.
To solve this issue, install 2.0.0-canary.13
or above as a dependency in your project, preferably matching the version you use to generate your site.
npm install @11ty/eleventy@2.0.0-canary.14
Thank you for the advice! In my case (maybe in addition to version conflicts), I had a dumb typo in name of the i18n plugin... it's working now.
Describe the bug
I tried to activate the new internationalization plugin with
v2.0.0-canary.14
. Simply adding it to the.eleventy.js
file as explained on https://www.11ty.dev/docs/plugins/i18n/#add-to-your-configuration-file and runningDEBUG=Eleventy* npx @11ty/eleventy@v2.0.0-canary.14
gives the following error:I tried this for my own small project and for https://github.com/11ty/eleventy-base-blog Probably I missed something. I'm new to all this, please indulge me...
To Reproduce Steps to reproduce the behavior:
.eleventy.js
, adding at the topand in the body of
module.exports = function(eleventyConfig) { ... }
, addDEBUG=Eleventy* npx @11ty/eleventy@v2.0.0-canary.14
Expected behavior
Project should have been built without error.
Environment: