Skip to content

Commit f9d3393

Browse files
chore: update vite + remove npm workaround hack
1 parent bd8aabe commit f9d3393

6 files changed

Lines changed: 26 additions & 203 deletions

File tree

deno.lock

Lines changed: 24 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/plugin-vite/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@types/node": "npm:@types/node@^24.1.0",
2828
"mime-db": "npm:mime-db@^1.54.0",
2929
"preact": "npm:preact@^10.26.9",
30-
"vite": "npm:vite@^7.0.6",
30+
"vite": "npm:vite@^7.1.2",
3131
"vite-plugin-inspect": "npm:vite-plugin-inspect@^11.3.2"
3232
}
3333
}

packages/plugin-vite/src/plugins/deno.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from "@deno/loader";
88
import * as path from "@std/path";
99
import * as babel from "@babel/core";
10-
import { npmWorkaround } from "./patches/npm_workaround.ts";
1110
import babelReact from "@babel/preset-react";
1211

1312
interface DenoState {
@@ -40,12 +39,6 @@ export function deno(): Plugin {
4039
async resolveId(id, importer, options) {
4140
const loader = options?.ssr ? ssrLoader : browserLoader;
4241

43-
// Workaround until upstream PR is merged and released,
44-
// see: https://github.com/vitejs/vite/pull/20558
45-
if (id.startsWith("deno-npm:")) {
46-
id = id.slice("deno-".length);
47-
}
48-
4942
importer = isDenoSpecifier(importer)
5043
? parseDenoSpecifier(importer).specifier
5144
: importer;
@@ -189,21 +182,6 @@ export function deno(): Plugin {
189182

190183
const code = new TextDecoder().decode(result.code);
191184

192-
// Ensure vite never sees `npm:` specifiers. The load call here
193-
// can potentially insert JSX pragmas which refer to `npm:`
194-
// specifiers.
195-
const res = babel.transformSync(code, {
196-
filename: id,
197-
babelrc: false,
198-
plugins: [npmWorkaround],
199-
});
200-
if (res?.code) {
201-
return {
202-
code: res.code,
203-
map: res.map,
204-
};
205-
}
206-
207185
return {
208186
code,
209187
};

packages/plugin-vite/src/plugins/patches.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Plugin } from "vite";
22
import * as babel from "@babel/core";
3-
import { npmWorkaround } from "./patches/npm_workaround.ts";
43
import { cjsPlugin } from "./patches/commonjs.ts";
54
import { jsxComments } from "./patches/jsx_comment.ts";
65
import babelReact from "@babel/preset-react";
@@ -31,7 +30,7 @@ export function patches(): Plugin {
3130
const res = babel.transformSync(code, {
3231
filename: id,
3332
babelrc: false,
34-
plugins: [npmWorkaround, cjsPlugin, jsxComments],
33+
plugins: [cjsPlugin, jsxComments],
3534
presets,
3635
});
3736

packages/plugin-vite/src/plugins/patches/npm_workaround.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/plugin-vite/src/plugins/patches/npm_workaround_test.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)