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

p has already been declared #209

Open
jameswoodley opened this issue Jan 2, 2025 · 9 comments
Open

p has already been declared #209

jameswoodley opened this issue Jan 2, 2025 · 9 comments

Comments

@jameswoodley
Copy link

Describe the bug

Migrating to Svelte5 and FormSnap 2 I am receiving the following errors:

../../node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected]_@sveltejs+vite-_6v7i3f4qrreri57chakwk5t6a4/node_modules/formsnap/dist/components/label.svelte:6:24: ERROR: [plugin: vite-plugin-svelte:optimize-svelte] /Users/jameswoodley/Development/incognifi/vnext/app/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected]_@sveltejs+vite-_6v7i3f4qrreri57chakwk5t6a4/node_modules/formsnap/dist/components/label.svelte:6:24 `p` has already been declared

I get them for what seems like every FormSnap component. I have followed the migration guide, and my Form now looks like

<script lang="ts">
	import type { SuperValidated, Infer } from 'sveltekit-superforms';
	import { superForm } from 'sveltekit-superforms';
	import { Field, Control, Label, FieldErrors } from 'formsnap';
	import { zodClient } from 'sveltekit-superforms/adapters';
	import { type EmailSchema, emailSchema } from './email-schema';

	import Loader from '$lib/components/loader.svelte';

	interface Props {
		loginData: SuperValidated<Infer<EmailSchema>>;
		back: () => void;
	}
	let { loginData, back }: Props = $props();

	const loginForm = superForm(loginData, { validators: zodClient(emailSchema), delayMs: 150 });
	const { form: loginFormData, enhance: loginEnhance, delayed: loginDelayed } = loginForm;
</script>

<div class="form">
	<h6>Sign In</h6>
	<h1>Welcome to Incognifi!</h1>
	<form method="POST" action="?/login" use:loginEnhance>
		<Field form={loginForm} name="email">
			<div class="input-group">
				<Control>
					{#snippet children({ props })}
						<Label>Email Address</Label>
						<input
							{...props}
							type="email"
							bind:value={$loginFormData.email}
							placeholder="Email Address"
						/>
					{/snippet}
				</Control>
				<FieldErrors />
			</div>
		</Field>

		<section id="buttons">
			<button class="primary">
				{#if $loginDelayed}
					<Loader />
				{:else}
					Login
				{/if}
			</button>

			<button class="tertiary" type="button" onclick={back} disabled={$loginDelayed}>Cancel</button>
		</section>
	</form>
</div>

<style>
	.form {
		width: 100%;
	}
</style>

Reproduction

Build form as per described, and run pnpm dev - errors will be shown in the console

Logs

No response

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1
    Memory: 168.28 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.5.0 - ~/.nvm/versions/node/v23.5.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.5.0/bin/npm
    pnpm: 9.15.2 - ~/.nvm/versions/node/v23.5.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.205
    Safari: 18.2

Severity

blocking all usage of Formsnap

@jameswoodley
Copy link
Author

[12:27:18.237] Running build in Washington, D.C., USA (East) – iad1
[12:27:18.325] Cloning github.com/jameswoodley/incognifi (Branch: here-we-go-again, Commit: bb1a04e)
[12:27:18.966] Cloning completed: 640.546ms
[12:27:20.336] Restored build cache from previous deployment (Hu2d1fRXKBKgUyMFSdXFnJU3kUo5)
[12:27:20.424] Running "vercel build"
[12:27:20.841] Vercel CLI 39.2.0
[12:27:20.979] > Detected Turbo. Adjusting default settings...
[12:27:21.643] Detected `pnpm-lock.yaml` version 9 generated by [email protected]
[12:27:21.644] Running "install" command: `pnpm install`...
[12:27:22.528] Scope: all 8 workspace projects
[12:27:22.721] ../..                                    | Progress: resolved 1, reused 0, downloaded 0, added 0
[12:27:22.799] ../..                                    | +195 ++++++++++++++++++++
[12:27:23.729] ../..                                    | Progress: resolved 195, reused 0, downloaded 19, added 5
[12:27:24.741] ../..                                    | Progress: resolved 195, reused 0, downloaded 42, added 29
[12:27:25.743] ../..                                    | Progress: resolved 195, reused 0, downloaded 72, added 61
[12:27:26.743] ../..                                    | Progress: resolved 195, reused 0, downloaded 82, added 69
[12:27:27.746] ../..                                    | Progress: resolved 195, reused 0, downloaded 100, added 89
[12:27:28.798] ../..                                    | Progress: resolved 195, reused 0, downloaded 170, added 156
[12:27:29.373] ../..                                    | Progress: resolved 195, reused 0, downloaded 193, added 195, done
[12:27:29.755] .../node_modules/svelte-preprocess postinstall$ echo "[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc..."
[12:27:29.770] .../node_modules/svelte-preprocess postinstall: [svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less, postcss & postcss-load-config, coffeescript, pug, etc...
[12:27:29.772] .../node_modules/svelte-preprocess postinstall: Done
[12:27:29.776] .../[email protected]/node_modules/esbuild postinstall$ node install.js
[12:27:29.860] .../[email protected]/node_modules/esbuild postinstall: Done
[12:27:29.891] .../node_modules/@sveltejs/kit postinstall$ node postinstall.js
[12:27:29.953] .../node_modules/@sveltejs/kit postinstall: Done
[12:27:30.078] 
[12:27:30.078] dependencies:
[12:27:30.078] + @incognifi/authorization 0.0.0 <- ../../packages/authorization
[12:27:30.078] + @kinde-oss/kinde-auth-sveltekit 2.1.0
[12:27:30.078] - @upstash/qstash 2.7.17
[12:27:30.078] + @upstash/qstash 2.7.20
[12:27:30.079] + formsnap 2.0.0
[12:27:30.079] + sveltekit-superforms 2.22.1
[12:27:30.079] + zod 3.24.1
[12:27:30.079] 
[12:27:30.079] devDependencies:
[12:27:30.079] + @csstools/postcss-global-data 3.0.0
[12:27:30.079] + @incognifi/utils 0.0.0 <- ../../packages/utils
[12:27:30.079] - @playwright/test 1.49.0
[12:27:30.079] + @playwright/test 1.49.1
[12:27:30.079] + @poppanator/sveltekit-svg 5.0.0
[12:27:30.079] - @sveltejs/adapter-vercel 5.5.0
[12:27:30.080] + @sveltejs/adapter-vercel 5.5.2
[12:27:30.080] - @sveltejs/enhanced-img 0.4.1
[12:27:30.080] + @sveltejs/enhanced-img 0.4.4
[12:27:30.080] - @sveltejs/kit 2.9.0
[12:27:30.080] + @sveltejs/kit 2.15.1
[12:27:30.080] - @sveltejs/vite-plugin-svelte 5.0.1
[12:27:30.080] + @sveltejs/vite-plugin-svelte 5.0.3
[12:27:30.080] - @typescript-eslint/eslint-plugin 8.17.0
[12:27:30.080] - @typescript-eslint/parser 8.17.0
[12:27:30.080] + autoprefixer 10.4.20
[12:27:30.080] - eslint 9.16.0
[12:27:30.080] + eslint 9.17.0
[12:27:30.080] + eslint-config-prettier 9.1.0
[12:27:30.081] + eslint-plugin-svelte 2.46.1
[12:27:30.081] + postcss-custom-media 11.0.5
[12:27:30.081] - svelte 5.8.0
[12:27:30.081] + svelte 5.16.0
[12:27:30.081] + svelte-preprocess 6.0.3
[12:27:30.081] + svelte-preprocess-import-assets 1.1.0
[12:27:30.081] - tslib 2.8.1
[12:27:30.081] + typescript-eslint 8.19.0
[12:27:30.081] - vite 6.0.3
[12:27:30.081] + vite 6.0.6
[12:27:30.081] - vitest 2.1.8
[12:27:30.081] + vitest 3.0.0-beta.3
[12:27:30.082] 
[12:27:30.125] Done in 8.3s
[12:27:30.459] 
[12:27:30.463] Attention:
[12:27:30.463] Turborepo now collects completely anonymous telemetry regarding usage.
[12:27:30.464] This information is used to shape the Turborepo roadmap and prioritize features.
[12:27:30.464] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[12:27:30.464] https://turbo.build/repo/docs/telemetry
[12:27:30.464] 
[12:27:30.493] • Packages in scope: @incognifi/web
[12:27:30.493] • Running build in 1 packages
[12:27:30.493] • Remote caching enabled
[12:27:30.683] @incognifi/web:build: cache miss, executing 1caaa8188f7c2f10
[12:27:31.174] @incognifi/web:build: 
[12:27:31.175] @incognifi/web:build: > @incognifi/[email protected] build /vercel/path0/apps/web
[12:27:31.175] @incognifi/web:build: > vite build
[12:27:31.176] @incognifi/web:build: 
[12:27:31.420] @incognifi/web:build: ▲ [WARNING] Cannot find base config file "./.svelte-kit/tsconfig.json" [tsconfig.json]
[12:27:31.421] @incognifi/web:build: 
[12:27:31.421] @incognifi/web:build:     tsconfig.json:2:12:
[12:27:31.421] @incognifi/web:build:       2 │   "extends": "./.svelte-kit/tsconfig.json",
[12:27:31.421] @incognifi/web:build:         ╵              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[12:27:31.421] @incognifi/web:build: 
[12:27:32.833] @incognifi/web:build: �[36mvite v6.0.6 �[32mbuilding SSR bundle for production...�[36m�[39m
[12:27:32.888] @incognifi/web:build: transforming...
[12:27:40.882] @incognifi/web:build: �[1mThe TypeScript option verbatimModuleSyntax is now required when using Svelte files with lang="ts". Please add it to your tsconfig.json.�[0m
[12:27:40.913] @incognifi/web:build: �[32m✓�[39m 1473 modules transformed.
[12:27:40.913] @incognifi/web:build: �[31mx�[39m Build failed in 8.05s
[12:27:40.914] @incognifi/web:build: �[31merror during build:
[12:27:40.914] @incognifi/web:build: �[31m[vite-plugin-svelte] [plugin vite-plugin-svelte] ../../node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected]_@sveltejs+vite-_6v7i3f4qrreri57chakwk5t6a4/node_modules/formsnap/dist/components/description.svelte (6:24): /vercel/path0/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected]_@sveltejs+vite-_6v7i3f4qrreri57chakwk5t6a4/node_modules/formsnap/dist/components/description.svelte:6:24 `p` has already been declared
[12:27:40.915] @incognifi/web:build: https://svelte.dev/e/declaration_duplicate�[31m
[12:27:40.915] @incognifi/web:build: file: �[36m/vercel/path0/node_modules/.pnpm/[email protected][email protected][email protected]_@[email protected]_@sveltejs+vite-_6v7i3f4qrreri57chakwk5t6a4/node_modules/formsnap/dist/components/description.svelte:6:24�[31m
[12:27:40.915] @incognifi/web:build: �[33m
[12:27:40.916] @incognifi/web:build:  4 |          t[p] = s[p];
[12:27:40.916] @incognifi/web:build:  5 |      if (s != null && typeof Object.getOwnPropertySymbols === "function")
[12:27:40.916] @incognifi/web:build:  6 |          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
[12:27:40.916] @incognifi/web:build:                                ^
[12:27:40.916] @incognifi/web:build:  7 |              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
[12:27:40.916] @incognifi/web:build:  8 |                  t[p[i]] = s[p[i]];
[12:27:40.916] @incognifi/web:build: �[31m
[12:27:40.917] @incognifi/web:build: �[39m
[12:27:41.551] @incognifi/web:build:  ELIFECYCLE  Command failed with exit code 1.
[12:27:41.565] @incognifi/web:build: ERROR: command finished with error: command (/vercel/path0/apps/web) /pnpm9/node_modules/.bin/pnpm run build exited (1)
[12:27:41.565] @incognifi/web#build: command (/vercel/path0/apps/web) /pnpm9/node_modules/.bin/pnpm run build exited (1)
[12:27:41.565] 
[12:27:41.566]  WARNING  finished with warnings
[12:27:41.566] 
[12:27:41.566] Warning - the following environment variables are set on your Vercel project, but missing from "turbo.json". These variables WILL NOT be available to your application and may cause your build to fail. Learn more at https://turbo.build/repo/docs/platform-environment-variables
[12:27:41.566] 
[12:27:41.566] [warn] @incognifi/web#build
[12:27:41.566] [warn]   - KINDE_CLIENT_ID 
[12:27:41.566] [warn]   - KINDE_CLIENT_SECRET 
[12:27:41.566] [warn]   - KINDE_ISSUER_URL 
[12:27:41.566] [warn]   - KINDE_REDIRECT_URL 
[12:27:41.566] [warn]   - KINDE_POST_LOGOUT_REDIRECT_URL 
[12:27:41.566] [warn]   - KINDE_POST_LOGIN_REDIRECT_URL 
[12:27:41.566] [warn]   - KINDE_SCOPE 
[12:27:41.566] [warn]   - PRIVATE_ENCRYPTION_KEY 
[12:27:41.567] [warn]   - PRIVATE_ENCRYPTION_IV 
[12:27:41.567] [warn]   - PRIVATE_FORWARD_EMAIL_TOKEN 
[12:27:41.567] [warn]   - PRIVATE_SMTP_USERNAME 
[12:27:41.567] [warn]   - PRIVATE_SMTP_PASSWORD 
[12:27:41.567] 
[12:27:41.567]   Tasks:    0 successful, 1 total
[12:27:41.567]  Cached:    0 cached, 1 total
[12:27:41.568]    Time:    11.099s 
[12:27:41.568] Summary:    /vercel/path0/.turbo/runs/2r4aa9jM1eXkAIDyNjLtQ8MteVn.json
[12:27:41.568]  Failed:    @incognifi/web#build
[12:27:41.568] 
[12:27:41.570]  ERROR  run failed: command  exited (1)
[12:27:41.578] Error: Command "turbo run build" exited with 1
[12:27:41.923] 

@huntabyte
Copy link
Member

I've noticed this issue happens when you have a disconnect somewhere in Vite / its dependencies. Can you reproduce with a fresh repo? If not, you may need to bump your vite/sveltekit/svelte vite plugins.

@jameswoodley
Copy link
Author

I've noticed this issue happens when you have a disconnect somewhere in Vite / its dependencies. Can you reproduce with a fresh repo? If not, you may need to bump your vite/sveltekit/svelte vite plugins.

I am on the latest of everything as far as I can tell:

"dependencies": {
		"@incognifi/application": "workspace:*",
		"@incognifi/authorization": "workspace:*",
		"@kinde-oss/kinde-auth-sveltekit": "^2.1.0",
		"@upstash/qstash": "^2.7.20",
		"formsnap": "^2.0.0",
		"sveltekit-superforms": "^2.22.1",
		"zod": "^3.24.1"
	},
	"devDependencies": {
		"@csstools/postcss-global-data": "^3.0.0",
		"@incognifi/eslint-config": "workspace:*",
		"@incognifi/utils": "workspace:*",
		"@playwright/test": "^1.49.1",
		"@poppanator/sveltekit-svg": "^5.0.0",
		"@sveltejs/adapter-vercel": "^5.5.2",
		"@sveltejs/enhanced-img": "^0.4.4",
		"@sveltejs/kit": "^2.15.1",
		"@sveltejs/vite-plugin-svelte": "^5.0.3",
		"autoprefixer": "^10.4.20",
		"eslint": "^9.17.0",
		"eslint-config-prettier": "^9.1.0",
		"eslint-plugin-svelte": "^2.46.1",
		"postcss-custom-media": "^11.0.5",
		"prettier": "^3.4.2",
		"prettier-plugin-svelte": "^3.3.2",
		"svelte": "^5.16.1",
		"svelte-check": "^4.1.1",
		"svelte-preprocess": "^6.0.3",
		"svelte-preprocess-import-assets": "^1.1.0",
		"typescript": "5.7.2",
		"typescript-eslint": "^8.19.0",
		"vite": "^6.0.7",
		"vitest": "3.0.0-beta.3"
	}

I'll also try a fresh repo

@jameswoodley
Copy link
Author

OK I can confirm it works fine on a new repo. Could it be because I'm using Turbo for monorepos? What might be next steps to getting this working?

@jameswoodley
Copy link
Author

I just installed all the same versions as in the fresh repo, and it still fails

@huntabyte
Copy link
Member

Likely an issue with your lockfile/try clearing node modules and reinstalling.

@jameswoodley
Copy link
Author

Legend, that seems to have done it. Thank you for the help!

@jameswoodley
Copy link
Author

Nope unfortunately it's re-occurred

@jameswoodley
Copy link
Author

Even deleting all node_modules, and a pnpm store prune hasn't resolved it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants