Skip to content

Commit

Permalink
types: add cjs, mts and cts to the supported extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 22, 2023
1 parent f773e2b commit e7d3ffb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type LoadFile = (
) => LoaderResult | Promise<LoaderResult>;

export interface LoaderOptions {
ext?: "mjs" | "js" | "ts";
ext?: "js" | "mjs" | "cjs" | "ts" | "mts" | "cts";
format?: "cjs" | "esm";
declaration?: boolean;
esbuild?: CommonOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/loaders/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const jsLoader: Loader = async (input, { options }) => {
.replace("module.exports = void 0;", "");
}

let extension = isCjs ? ".js" : ".mjs";
let extension = isCjs ? ".js" : ".mjs"; // TODO: Default to .cjs in next major version
if (options.ext) {
extension = options.ext.startsWith(".") ? options.ext : `.${options.ext}`;
}
Expand Down

0 comments on commit e7d3ffb

Please sign in to comment.