Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: support Windows path separator in optimize fake build directory regex #1813

Merged
merged 1 commit into from
Dec 4, 2020
Merged
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
8 changes: 4 additions & 4 deletions snowpack/src/build/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface ScannedHtmlEntrypoint {
// has a bug where it complains about overwriting source files even when write: false.
// We create a fake bundle directory for now. Nothing ever actually gets written here.
const FAKE_BUILD_DIRECTORY = path.join(PROJECT_CACHE_DIR, '~~bundle~~');
const FAKE_BUILD_DIRECTORY_REGEX = /.*\~\~bundle\~\~\//;
const FAKE_BUILD_DIRECTORY_REGEX = /.*\~\~bundle\~\~[\\\/]/;
/**
* Scan a directory and remove any empty folders, recursively.
*/
Expand Down Expand Up @@ -494,9 +494,9 @@ export async function runBuiltInOptimize(config: SnowpackConfig) {
logger.debug(`bundleEntrypoints: ${JSON.stringify(bundleEntrypoints)}`);

if ((!htmlEntrypoints || htmlEntrypoints.length === 0) && bundleEntrypoints.length === 0) {
throw new Error(
'[optimize] No HTML entrypoints detected. Set "entrypoints" manually if your site HTML is generated outside of Snowpack (SSR, Rails, PHP, etc.).',
);
throw new Error(
'[optimize] No HTML entrypoints detected. Set "entrypoints" manually if your site HTML is generated outside of Snowpack (SSR, Rails, PHP, etc.).',
);
}

// NOTE: esbuild has no `cwd` support, and assumes that you're always bundling the
Expand Down