Skip to content
This repository was archived by the owner on Nov 17, 2024. It is now read-only.

Commit 53f31da

Browse files
committed
Use allowArbitraryExtensions option in
typed-css-modules
1 parent 49a5b0f commit 53f31da

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

vite/typed-css-modules.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import path from 'node:path';
1616
import DtsCreator from 'typed-css-modules';
1717
import find from 'find';
1818
import {defaultImport} from 'default-import';
19-
import type {DtsContent} from 'typed-css-modules/lib/dts-content.js';
2019
import {definePlugin} from './plugin-helper.js';
2120

2221
const files: readonly string[] = await new Promise((resolve) => {
@@ -29,21 +28,11 @@ const newCreator = () =>
2928
dropExtension: false,
3029
outDir: path.join('build', 'types'),
3130
namedExports: true,
31+
allowArbitraryExtensions: true,
3232
});
3333

3434
const writeTypes = async (file: string, creator = newCreator()) => {
3535
const content = await creator.create(file);
36-
37-
Object.defineProperty(content, 'outputFileName', {
38-
get(this: DtsContent) {
39-
// @ts-expect-error DtsContent does not allow us to modify the
40-
// extension, so we need to: redefine a private accessor, and read
41-
// the file path from a private property.
42-
const rInputPath = this.rInputPath as string;
43-
return rInputPath.replace(/\.css$/, '') + '.d.css.ts';
44-
},
45-
});
46-
4736
await content.writeFile();
4837
};
4938

0 commit comments

Comments
 (0)