Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Eleventy from 2 to 3 #98

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

otegami
Copy link
Collaborator

@otegami otegami commented Oct 8, 2024

ref: #92

Eleventy v3.0.0 fully supports ESM.

Additionally, using require("@11ty/eleventy") with Eleventy v3.0.0 results
in compatibility issues as follows. Therefore, this is an appropriate time to
migrate our configuration from CommonJS to ESM.

> [email protected] build:11ty
> eleventy --pathprefix=hotwire_ja

[11ty] Eleventy Error (CLI):
[11ty] 1. Error in your Eleventy config file '.eleventy.js'. (via EleventyConfigError)
[11ty] 2. `require("@11ty/eleventy")` is incompatible with Eleventy v3 and this version of Node. You have a few options:
[11ty]    1. (Easiest) Change the `require` to use a dynamic import inside of an asynchronous CommonJS configuration
[11ty]       callback, for example:
[11ty]
[11ty]       module.exports = async function {
[11ty]         const {EleventyRenderPlugin, EleventyI18nPlugin, EleventyHtmlBasePlugin} = await import("@11ty/eleventy");
[11ty]       }
[11ty]
[11ty]    2. (Easier) Update the JavaScript syntax in your configuration file from CommonJS to ESM (change `require`
[11ty]       to use `import` and rename the file to have an `.mjs` file extension).
[11ty]
[11ty]    3. (More work) Change your project to use ESM-first by adding `"type": "module"` to your package.json. Any
[11ty]       `.js` will need to be ported to use ESM syntax (or renamed to `.cjs`.)
[11ty]
[11ty]    4. (Short term workaround) Use the --experimental-require-module flag to enable this behavior. Read
[11ty]       more: https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require It is possible that the
[11ty]       newest version of Node has this enabled by default—you can try upgrading your version of Node.js.
ERROR: "build:11ty" exited with 1.

@akira888
Copy link
Contributor

おお、11tyのUPGRADE!

@otegami otegami force-pushed the upgrade-eleventy-from-2-to-3 branch 4 times, most recently from 080210e to 5aee82c Compare October 22, 2024 12:09
@otegami
Copy link
Collaborator Author

otegami commented Oct 22, 2024

@akira888
11tyを試しにあげてみました。既存の設定を壊さないで上げてみたので良かったらレビューをお願いします 🙏
差分が多いですが、主にpackage.jsonの変更なので実質的にはそんなに変更を入れてないですmm

@otegami otegami requested a review from akira888 October 22, 2024 12:12
Eleventy v3.0.0 fully supports ESM.
- ref: https://github.com/11ty/eleventy/releases/tag/v3.0.0

Additionally, using `require("@11ty/eleventy")` with Eleventy v3.0.0 results
in compatibility issues as follows. Therefore, this is an appropriate time to
migrate our configuration from CommonJS to ESM.

```
> [email protected] build:11ty
> eleventy --pathprefix=hotwire_ja

[11ty] Eleventy Error (CLI):
[11ty] 1. Error in your Eleventy config file '.eleventy.js'. (via EleventyConfigError)
[11ty] 2. `require("@11ty/eleventy")` is incompatible with Eleventy v3 and this version of Node. You have a few options:
[11ty]    1. (Easiest) Change the `require` to use a dynamic import inside of an asynchronous CommonJS configuration
[11ty]       callback, for example:
[11ty]
[11ty]       module.exports = async function {
[11ty]         const {EleventyRenderPlugin, EleventyI18nPlugin, EleventyHtmlBasePlugin} = await import("@11ty/eleventy");
[11ty]       }
[11ty]
[11ty]    2. (Easier) Update the JavaScript syntax in your configuration file from CommonJS to ESM (change `require`
[11ty]       to use `import` and rename the file to have an `.mjs` file extension).
[11ty]
[11ty]    3. (More work) Change your project to use ESM-first by adding `"type": "module"` to your package.json. Any
[11ty]       `.js` will need to be ported to use ESM syntax (or renamed to `.cjs`.)
[11ty]
[11ty]    4. (Short term workaround) Use the --experimental-require-module flag to enable this behavior. Read
[11ty]       more: https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require It is possible that the
[11ty]       newest version of Node has this enabled by default—you can try upgrading your version of Node.js.
ERROR: "build:11ty" exited with 1.
```
@otegami otegami force-pushed the upgrade-eleventy-from-2-to-3 branch from 5aee82c to 2aaeed3 Compare October 22, 2024 12:17
Copy link
Contributor

@akira888 akira888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build時に SASSについて とやかく言われているのを見かけてしまいましたがw
11ty自体の version up は問題なさそうでした!
早めの追随ありがとうございます!

@akira888
Copy link
Contributor

akira888 commented Nov 3, 2024

SassはもうひとつのPRでご対応いただいていたのですね
ありがとうございます!

@otegami
Copy link
Collaborator Author

otegami commented Nov 4, 2024

レビューありがとうございます。マージします!

@otegami otegami merged commit 3d1cda1 into everyleaf:main Nov 4, 2024
1 check passed
@otegami otegami deleted the upgrade-eleventy-from-2-to-3 branch November 4, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants