Skip to content

Commit 160e4f7

Browse files
committed
Support for ES modules and Vite 5
1 parent 0490ed5 commit 160e4f7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import fs from "fs";
2-
import { AddressInfo } from "net";
32
import path from "path";
43
import colors from "picocolors";
4+
import { fileURLToPath } from 'url';
5+
import { AddressInfo } from "net";
56
import {
67
Plugin,
78
loadEnv,
@@ -17,6 +18,9 @@ import fullReload, {
1718
Config as FullReloadConfig,
1819
} from "vite-plugin-full-reload";
1920

21+
const __filename = fileURLToPath(import.meta.url);
22+
const __dirname = path.dirname(__filename);
23+
2024
interface PluginConfig {
2125
/**
2226
* The path or paths of the entry points to compile.

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
33
"outDir": "./dist",
4-
"target": "ES2019",
5-
"module": "commonjs",
4+
"target": "ES2020",
5+
"module": "es2020",
66
"moduleResolution": "node",
77
"resolveJsonModule": true,
88
"strict": true,

0 commit comments

Comments
 (0)