Skip to content

Commit

Permalink
I think the custom externals stuff has a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Apr 26, 2024
1 parent 0ce294a commit fa16b45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions workspace/dev-compile/src/rollup/plugins/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ import type { RollupPlugin } from "../utils.js";
* @param {PackageInfo} pkg
* @returns {import("rollup").Plugin}
*/
export default function externals(pkg: PackageInfo): RollupPlugin {
const isExternal = external(pkg);
export default function externals(pkg: PackageInfo, mode: 'development' | 'production'): RollupPlugin {
const isExternal = external(pkg, mode);

return {
name: "starbeam:externals",
Expand All @@ -222,7 +222,7 @@ export default function externals(pkg: PackageInfo): RollupPlugin {
* @param {PackageInfo} pkg
* @returns
*/
function external(pkg: PackageInfo) {
function external(pkg: PackageInfo, mode: 'development' | 'production') {
/**
* @param {string} id
* @returns {boolean}
Expand All @@ -233,8 +233,15 @@ function external(pkg: PackageInfo) {
return INLINE;
}

if (mode === 'production') {
if (id.startsWith('@starbeam/debug') || id.startsWith('@starbeam/verify')) {
return INLINE;
}
}

// Resolve custom rules. These rules include the default behavior of
// well-known helper libraries.
console.log(pkg.starbeam);
for (const rule of pkg.starbeam.inline) {
const isExternal = resolveIsExternal(rule, id);
if (isExternal !== undefined) return isExternal;
Expand Down
2 changes: 1 addition & 1 deletion workspace/dev-compile/src/rollup/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function compilePackage(pkg: PackageInfo, options: CompileOptions): RollupOption
...options,
plugins: [
...PLUGINS,
externals(pkg),
externals(pkg, mode),
typescript(mode)(pkg, {
target: "esnext",
module: "esnext",
Expand Down

0 comments on commit fa16b45

Please sign in to comment.