Skip to content

Commit

Permalink
fix: fixed cache issue with isolated-declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Sep 20, 2024
1 parent 7119b6b commit 92d1029
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/packem/packem.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import isolatedDeclarationTransformer from "./src/rollup/plugins/typescript/isol
// eslint-disable-next-line import/no-unused-modules
export default defineConfig({
cjsInterop: true,
fileCache: false,
fileCache: true,
isolatedDeclarationTransformer,
rollup: {
license: {
Expand Down
4 changes: 3 additions & 1 deletion packages/packem/src/rollup/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const build = async (context: BuildContext, fileCache: FileCache, subDirectory:
return;
}

rollupOptions.cache = fileCache.get<RollupCache>(BUNDLE_CACHE_KEY, subDirectory);
if (!context.options.rollup.isolatedDeclarations || !context.options.isolatedDeclarationTransformer) {
rollupOptions.cache = fileCache.get<RollupCache>(BUNDLE_CACHE_KEY, subDirectory);
}

const buildResult = await rollup(rollupOptions);

Expand Down
4 changes: 3 additions & 1 deletion packages/packem/src/rollup/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const watch = async (context: BuildContext, fileCache: FileCache): Promise<void>
return;
}

rollupOptions.cache = fileCache.get<RollupCache>(WATCH_CACHE_KEY);
if (!context.options.rollup.isolatedDeclarations || !context.options.isolatedDeclarationTransformer) {
rollupOptions.cache = fileCache.get<RollupCache>(WATCH_CACHE_KEY);
}

if (context.options.rollup.watch && typeof rollupOptions.watch === "object" && rollupOptions.watch.include === undefined) {
rollupOptions.watch = {
Expand Down
2 changes: 1 addition & 1 deletion packages/packem/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "*.d.ts"],
"include": ["src/**/*", "*.d.ts", "./packem.config.ts"],
"compilerOptions": {
"moduleResolution": "Bundler"
}
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,

"allowJs": false,
"checkJs": false,
"isolatedDeclarations": true,
"allowJs": true,
"checkJs": true,
"isolatedDeclarations": false,
"noErrorTruncation": true
},
"exclude": ["dist/**/*", "node_modules/**/*", "build/**/*", "scripts/**/*", "examples/**", "**/coverage/**"]
Expand Down

0 comments on commit 92d1029

Please sign in to comment.