We're OGS, check out our work on github.com/ogs-gmbh
Handles and resolves import extensions automatically, ensuring consistent module specifiers and seamless compatibility across different environments and build configurations.
-
Default Extension Resolution
Assigns a predefined default extension to imports that omit an explicit file extension. -
Extension Transformation
Converts existing import extensions into alternative target extensions according to configurable rules. -
ESM Compliance
Maintains compatibility with ECMAScript module semantics and modern Node.js resolution behavior. -
Transparent Integration
Integrates seamlessly into existing build pipelines with minimal configuration overhead.
Important
We're offering an extensive API-Reference covered with in-depth usage examples of this project.
To get a starting point, simply refer to our documentation at ogs-gmbh.github.io/rolldown-plugin-extensions.
- Node.js version 18 or higher
- A package manager: e.g. npm, pnpm, ...
Using npm:
$ npm add -D @ogs-gmbh/rolldown-plugin-extensionsUsing a different package manager?
Using yarn:
$ pnpm add -D @ogs-gmbh/rolldown-plugin-extensionsUsing pnpm:
$ pnpm add -D @ogs-gmbh/rolldown-plugin-extensionsUsing bun:
$ bun add -D @ogs-gmbh/rolldown-plugin-extensionsrolldown-plugin-extensions can be integrated with either tsdown or Rolldown. Here's an example showing the usage of this plugin with tsdown. You can get a deeper understanding about this plugin by taking a look into the reference.
import { defineConfig } from "tsdown";
import { extensionsPlugin } from "@ogs-gmbh/rolldown-plugin-extensions";
export default defineConfig({
entry: "src/**/*.ts",
dts: true,
outDir: "dist/main",
unbundle: true,
plugins: [
extensionsPlugin({
defaultExtensions: ".mjs",
extensions: {
".js": ".mjs",
".ts": ".mts"
}
})
]
});If a file gets referenced by any import or export statement, .mjs will be added to import targets, that doesn't include a extension. Files with .js and .ts extensions will be manipulated to have .mjs and .mts extensions instead.
The MIT License (MIT) - Please have a look at the LICENSE file for more details.
Contributions are always welcome and greatly appreciated. Whether you want to report a bug, suggest a new feature, or improve the documentation, your input helps make the project better for everyone.
Feel free to submit a pull request, issue or feature request.
Reporting an issue or creating a feature request is made by creating a new issue on this repository.
You can create a new issue or feature request here.
GitHub offers a solid guideline for contributing to open source projects through pull requests, covering key practices. These best practices provide a reliable starting point for making effective contributions.
You can find the guidelines here.
We are committed to keeping a welcoming, inclusive, and respectful community for everyone. To help us achieve this, we kindly ask that you adhere to our Code of Conduct.
All trademarks and registered trademarks mentioned are property of their respective owners and are used for identification purposes only. Use of these names does not imply endorsement or affiliation.
This project is a trademark of OGS Gesellschaft für Datenverarbeitung und Systemberatung mbH. The License does not grant rights to use the trademark without permission.
Gesellschaft für Datenverarbeitung und Systemberatung mbH
