Skip to content

Commit

Permalink
Fixed .mjs proxies generation in conditions builds (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jul 3, 2023
1 parent a096eaa commit d4006c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/clean-crabs-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@preconstruct/cli": patch
---

Fixed `.mjs` proxies generation with `___experimentalFlags_WILL_CHANGE_IN_PATCH.importsConditions` and `exports.importConditionDefaultExport: 'default'`
15 changes: 15 additions & 0 deletions packages/cli/src/build/__tests__/imports-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ test("imports conditions", async () => {
exports.something = something;
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.browser.cjs.mjs ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
export {
something
} from "./scope-pkg.browser.cjs.js";
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.browser.development.cjs.js ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
'use strict';
Expand All @@ -147,6 +152,11 @@ test("imports conditions", async () => {
exports.something = something;
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.browser.development.cjs.mjs ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
export {
something
} from "./scope-pkg.browser.development.cjs.js";
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.browser.development.esm.js ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
function something() {
console.log("a");
Expand Down Expand Up @@ -217,6 +227,11 @@ test("imports conditions", async () => {
exports.something = something;
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.development.cjs.mjs ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
export {
something
} from "./scope-pkg.development.cjs.js";
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ dist/scope-pkg.development.esm.js ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
function something() {
console.log("a");
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/build/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export let getRollupConfig = (
resolveErrorsPlugin(pkg, warnings, options.kind === "umd"),
(options.kind === "node-prod" || isDefaultConditionsBuild) &&
typescriptDeclarations(pkg),
(options.kind === "node-prod" || isDefaultConditionsBuild) &&
(options.kind === "node-prod" || options.kind === "conditions") &&
pkg.exportsFieldConfig()?.importConditionDefaultExport === "default" &&
mjsProxy(pkg),
serverComponentsPlugin({ sourceMap: options.kind === "umd" }),
Expand Down

0 comments on commit d4006c8

Please sign in to comment.