diff --git a/package.json b/package.json index ab6cbf4..5295ae7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ }, "peerDependencies": { "@babel/core": "7.x", - "vite": "2.x" + "vite": "2.x || 3.x" }, "devDependencies": { "@babel/core": "^7.15.8", diff --git a/src/index.ts b/src/index.ts index 26ec325..ba41eb7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,6 @@ import type { FilterPattern } from "@rollup/pluginutils"; import type { ParserPlugin, ParserOptions } from "@babel/parser"; import type { TransformOptions } from "@babel/core"; -import resolve from "resolve"; import prefresh from "@prefresh/vite"; import { preactDevtoolsPlugin } from "./devtools.js"; import { createFilter, parseId } from "./utils.js"; @@ -89,24 +88,6 @@ export default function preactPlugin({ configResolved(resolvedConfig) { config = resolvedConfig; }, - resolveId(id: string) { - return id === "preact/jsx-runtime" ? id : null; - }, - load(id: string) { - if (id === "preact/jsx-runtime") { - const runtimePath = resolve.sync("preact/jsx-runtime", { - basedir: config.root, - }); - const exports = ["jsx", "jsxs", "Fragment"]; - return [ - `import * as jsxRuntime from ${JSON.stringify(runtimePath)}`, - // We can't use `export * from` or else any callsite that uses - // this module will be compiled to `jsxRuntime.exports.jsx` - // instead of the more concise `jsx` alias. - ...exports.map(name => `export const ${name} = jsxRuntime.${name}`), - ].join("\n"); - } - }, async transform(code, url) { // Ignore query parameters, as in Vue SFC virtual modules. const { id } = parseId(url);