Skip to content

Commit

Permalink
Fix: support Windows path separator in optimize fake regex (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrage authored Dec 4, 2020
1 parent e807dff commit 2f7ef26
Showing 1 changed file with 4 additions and 4 deletions.
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

1 comment on commit 2f7ef26

@vercel
Copy link

@vercel vercel bot commented on 2f7ef26 Dec 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.