diff --git a/.changeset/unlucky-experts-shout.md b/.changeset/unlucky-experts-shout.md
new file mode 100644
index 0000000..b8c6fbc
--- /dev/null
+++ b/.changeset/unlucky-experts-shout.md
@@ -0,0 +1,5 @@
+---
+"stack54": patch
+---
+
+Fixes views build failure caused by when no view found in project directory
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..0a68740
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "stack54-monorepo",
+ "version": "1.0.0",
+ "description": "",
+ "author": "Joshua Amaju",
+ "license": "ISC",
+ "private": true,
+ "keywords": [],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/joshamaju/stack54.git"
+ },
+ "scripts": {
+ "test": "pnpm test -r",
+ "changeset": "changeset",
+ "version": "changeset version",
+ "release": "changeset publish",
+ "build": "tsc -b tsconfig.build.json"
+ },
+ "devDependencies": {
+ "@changesets/cli": "^2.27.1",
+ "playwright": "^1.41.1",
+ "typescript": "^5.3.3"
+ }
+}
diff --git a/packages/core/src/core/build/view.ts b/packages/core/src/core/build/view.ts
index 1746073..aa7947c 100644
--- a/packages/core/src/core/build/view.ts
+++ b/packages/core/src/core/build/view.ts
@@ -116,56 +116,60 @@ export function buildViews({
// @ts-ignore build gets the filtered type wrong
const facades = new Map(facade_keypairs.filter((_) => _ !== undefined));
- const resolve: Plugin = {
- name: "facade-resolver",
- async resolveId(source, importer) {
- if (importer) {
- const [importer_] = importer.split("?");
-
- /**
- * resolves imports (including import aliases) inside inline script and modules script tags
- * i.e
- *
- */
- if (facades.has(importer_)) {
- // reconstruct the original svelte file name from the html facade
- const original = importer_.replace(generated_dir, "");
-
- const { dir, name } = path.parse(original);
- const view = path.join(dir, `${name}.svelte`);
-
- const resolved = await this.resolve(source, view);
-
- if (resolved) return resolved;
-
- const file = path.resolve(path.dirname(original), source);
- if (await fse.exists(file)) return file;
+ if (facades.size > 0) {
+ const resolve: Plugin = {
+ name: "facade-resolver",
+ async resolveId(source, importer) {
+ if (importer) {
+ const [importer_] = importer.split("?");
+
+ /**
+ * resolves imports (including import aliases) inside inline script and modules script tags
+ * i.e
+ *
+ */
+ if (facades.has(importer_)) {
+ // reconstruct the original svelte file name from the html facade
+ const original = importer_.replace(generated_dir, "");
+
+ const { dir, name } = path.parse(original);
+ const view = path.join(dir, `${name}.svelte`);
+
+ const resolved = await this.resolve(source, view);
+
+ if (resolved) return resolved;
+
+ const file = path.resolve(path.dirname(original), source);
+ if (await fse.exists(file)) return file;
+ }
}
- }
- },
- };
-
- const env_define = define(env);
-
- const inline_config: vite.InlineConfig = {
- logLevel: "silent",
- define: env_define,
- mode: "production",
- plugins: [resolve, obfuscate, deobfuscate],
- build: {
- ssr: false,
- outDir: build_dir,
- rollupOptions: { input: [...facades.keys()] },
- },
- };
+ },
+ };
+
+ const env_define = define(env);
+
+ const inline_config: vite.InlineConfig = {
+ logLevel: "silent",
+ define: env_define,
+ mode: "production",
+ plugins: [resolve, obfuscate, deobfuscate],
+ build: {
+ ssr: false,
+ outDir: build_dir,
+ rollupOptions: { input: [...facades.keys()] },
+ },
+ };
- yield* Effect.tryPromise(() => {
- return vite.build(vite.mergeConfig(config.vite, inline_config));
- });
+ yield* Effect.tryPromise(() => {
+ return vite.build(vite.mergeConfig(config.vite, inline_config));
+ });
+ } else {
+ yield* Effect.logWarning("No views to build");
+ }
const modules = yield* Effect.forEach(
facades,