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

Clarify that you need to use .ts files when extending plugins if you use TypeScript #2052

Closed
Whimfoome opened this issue Mar 12, 2024 · 1 comment · Fixed by #2075
Closed
Assignees

Comments

@Whimfoome
Copy link

Link to the documentation page or resource

https://docs.strapi.io/dev-docs/plugins-extension

Describe the bug

The examples are using the .js file extension and nowhere is clarified that you need to use .ts if you are using TypeScript.

I got a bit confused, because the plugin I was extending was written in JS, and I though that there is no problem to extend it using .js files, because in the documentation it says that:

When a Strapi application is initializing, plugins, extensions and global lifecycle functions events happen in the following order:

Plugins are loaded and their interfaces are exposed.
**Files in ./src/extensions are loaded.** <---
The register() and bootstrap() functions in ./src/index.js are called.
A plugin's interface can be extended at step 2 (i.e. within ./src/extensions) or step 3 (i.e. inside ./src/index.js).

I think it would be a good idea to clarify that they won't be compiled if you are using TypeScript for the project and that you should use .ts extension.

Additional context

No response

Suggested improvements or fixes

No response

Related issue(s)/PR(s)

No response

@pwizla
Copy link
Collaborator

pwizla commented Apr 8, 2024

Thanks, @Whimfoome. It has been fixed in #2075. It is now merged and will soon be live on the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants