Skip to content

Commit 308c920

Browse files
committed
fix: invert condition for star
1 parent 952f9d1 commit 308c920

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,22 @@ export function deno(): Plugin {
3535
config(_, env) {
3636
isDev = env.command === "serve";
3737
},
38-
async configResolved() {
38+
async configResolved(config) {
39+
const denoJson = path.resolve(config.root, "deno.json");
40+
3941
// TODO: Pass conditions
4042
ssrLoader = await new Workspace({
4143
platform: "node",
4244
cachedOnly: true,
45+
configPath: denoJson,
46+
debug: true,
4347
}).createLoader();
4448
browserLoader = await new Workspace({
4549
platform: "browser",
4650
preserveJsx: true,
4751
cachedOnly: true,
52+
configPath: denoJson,
53+
debug: true,
4854
})
4955
.createLoader();
5056
},

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,13 @@ export function cjsPlugin(
285285
path.pushContainer(
286286
"body",
287287
t.ifStatement(
288-
t.binaryExpression(
289-
"in",
290-
t.stringLiteral("default"),
291-
t.identifier("exports"),
288+
t.unaryExpression(
289+
"!",
290+
t.binaryExpression(
291+
"in",
292+
t.stringLiteral("default"),
293+
t.identifier("exports"),
294+
),
292295
),
293296
t.forInStatement(
294297
t.variableDeclaration("var", [

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Deno.test("commonjs - detect esbuild shims", () => {
368368
import * as _ns from "./globalThis";
369369
export * from "./globalThis";
370370
${DEFAULT_EXPORT}
371-
if ("default" in exports) for (var _k in _ns) if (_k !== "default" && _k !== "__esModule" && Object.prototype.hasOwnProperty.call(_ns, _k)) _default[_k] = _ns[_k];
371+
if (!("default" in exports)) for (var _k in _ns) if (_k !== "default" && _k !== "__esModule" && Object.prototype.hasOwnProperty.call(_ns, _k)) _default[_k] = _ns[_k];
372372
${DEFAULT_EXPORT_END}`,
373373
});
374374
});
@@ -510,7 +510,7 @@ Object.defineProperty(exports, "__esModule", {
510510
});
511511
export * from "./node";
512512
${DEFAULT_EXPORT}
513-
if ("default" in exports) for (var _k in _ns) if (_k !== "default" && _k !== "__esModule" && Object.prototype.hasOwnProperty.call(_ns, _k)) _default[_k] = _ns[_k];
513+
if (!("default" in exports)) for (var _k in _ns) if (_k !== "default" && _k !== "__esModule" && Object.prototype.hasOwnProperty.call(_ns, _k)) _default[_k] = _ns[_k];
514514
${DEFAULT_EXPORT_END}
515515
${EXPORT_ES_MODULE}`,
516516
});

0 commit comments

Comments
 (0)