Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type { BundleStylesheetOptions } from './bundle-options';
* - `publicPath`: Affects relative asset URL rewriting (`url('...')`) inside CSS output.
* - `outputNames`: Affects asset output filename hashing schemes.
* - `inlineFonts`: Controls whether external web font `@import` / `<link>` directives are inlined.
* - `dataurl`: Controls whether referenced assets are inlined as base64 data URIs.
* - `preserveSymlinks`: Controls symlink realpath resolution in monorepos/pnpm workspace packages.
* - `externalDependencies`: Controls which CSS modules/urls are excluded from bundling.
* - `postcssConfig`: Path to custom PostCSS configuration file.
Expand Down Expand Up @@ -56,6 +57,7 @@ export function calculateGlobalStylesheetConfigHash(
publicPath: options.publicPath,
outputNames: options.outputNames,
inlineFonts: options.inlineFonts,
dataurl: options.dataurl ?? false,
preserveSymlinks: options.preserveSymlinks,
externalDependencies: options.externalDependencies,
postcssConfig: options.postcssConfiguration?.configPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,20 @@ describe('Stylesheet Global Config Hash', () => {
);
expect(hash1).not.toBe(hash2);
});

it('should produce different hashes when dataurl changes', () => {
const hash1 = calculateGlobalStylesheetConfigHash(baseOptions, '1.0.0');
const hash2 = calculateGlobalStylesheetConfigHash({ ...baseOptions, dataurl: true }, '1.0.0');
expect(hash1).not.toBe(hash2);
});
Comment thread
clydin marked this conversation as resolved.

it('should produce the same hash when dataurl is undefined or false', () => {
const hash1 = calculateGlobalStylesheetConfigHash(baseOptions, '1.0.0');
const hash2 = calculateGlobalStylesheetConfigHash(
{ ...baseOptions, dataurl: false },
'1.0.0',
);
expect(hash1).toBe(hash2);
});
});
});
Loading