sveltejs / cli

The Svelte CLI
MIT License
259 stars 11 forks source link

Missing $lib/paraglide from skeleton project #258

Open pe1uca opened 3 weeks ago

pe1uca commented 3 weeks ago

When creating a project using bunx sv create new-project and selecting the options below, the app doesn't run with error ENOENT: No such file or directory

This seems to be because the project doesn't include the files necessary inside src/lib/paraglide which are referenced in the vite.config.ts file.
After commenting the paraglide plugin and the references in the project it can properly start.

┌  Welcome to the Svelte CLI! (v0.5.11)
│
◇  Which template would you like?
│  SvelteKit minimal
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  prettier, eslint, vitest, playwright, tailwindcss, drizzle, lucia, paraglide
│
◇  tailwindcss: Which plugins would you like to add?
│  forms, container-queries, aspect-ratio
│
◇  drizzle: Which database would you like to use?
│  PostgreSQL
│
◇  drizzle: Which PostgreSQL client would you like to use?
│  Postgres.JS
│
◇  drizzle: Do you want to run the database locally with docker-compose?
│  Yes
│
◇  lucia: Do you want to include a demo? (includes a login/register page)
│  Yes
│
◇  paraglide: Which languages would you like to support? (e.g. en,de-ch)
│  es,en
│
◇  paraglide: Do you want to include a demo?
│  Yes
│
◇  Which package manager do you want to install dependencies with?
│  bun
AdrianGonz97 commented 3 weeks ago

Unfortunately, I'm unable to replicate the issue with the provided selections. Can you trim it down to only the minimally reproducible portions (i.e. only selecting paraglide rather than every add-on) and providing a link to a reproduction repo?

pe1uca commented 2 weeks ago

Same thing with minimal options selected, here's the link to the repo https://github.com/pe1uca/testSvCreate

┌  Welcome to the Svelte CLI! (v0.5.11)
│
◇  Which template would you like?
│  SvelteKit minimal
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  paraglide
│
◇  Which languages would you like to support? (e.g. en,de-ch)
│  es,en
│
◇  Do you want to include a demo?
│  Yes
│
◇  Which package manager do you want to install dependencies with?
│  bun
│
◆  Successfully setup integrations
│
◇  Successfully installed dependencies
geko1971 commented 2 weeks ago

@pe1uca I experienced the same issue, but it was eventually simply the fetch of inlang plugins from https://cdn.jsdelivr.net failing at compilation time.

When running pnpm dev I got several errors like the following:

ERROR  Couldn't import the plugin "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js":

ModuleImportError: Couldn't import the plugin "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js":

TypeError: fetch failed

I solved by disabling SSL verification for the process as a workaround.

HTH...

dominikg commented 2 weeks ago

you can load the inlang plugins from node_modules via fs path instead. just install the packages for them as devDependency.

waedi commented 1 week ago

you can load the inlang plugins from node_modules via fs path instead. just install the packages for them as devDependency.

Can you give some more detailed instructions, please? I am pretty new and cannot get it to work. bun add complains about blocked postinstalls and the provided steps to solve those don't work either. Then I also do not know where I have to load the inlang plugins. Maybe I should abandon bun for the moment.

manuel3108 commented 1 week ago

Since this seems to be problematic for at least 3 users , we should check if we can find another way to do this.

paoloricciuti commented 1 week ago

you can load the inlang plugins from node_modules via fs path instead. just install the packages for them as devDependency.

Can you give some more detailed instructions, please? I am pretty new and cannot get it to work. bun add complains about blocked postinstalls and the provided steps to solve those don't work either. Then I also do not know where I have to load the inlang plugins. Maybe I should abandon bun for the moment.

Yeah I actually did it for job and you have to patch the package to remove the post install.

Curiously they basically just read the file and eval it instead of actually importing it so if you really want I guess you could include it just as a copy pasted file

dominikg commented 1 week ago

you add this in paraglide settings.json instead of the jsdelivr urls

    "modules": [
        "node_modules/@inlang/message-lint-rule-empty-pattern/dist/index.js",
        "node_modules/@inlang/message-lint-rule-identical-pattern/dist/index.js",
        "node_modules/@inlang/message-lint-rule-missing-translation/dist/index.js",
        "node_modules/@inlang/message-lint-rule-without-source/dist/index.js",
        "node_modules/@inlang/message-lint-rule-valid-js-identifier/dist/index.js",
        "node_modules/@inlang/plugin-message-format/dist/index.js",
        "node_modules/@inlang/plugin-m-function-matcher/dist/index.js"
    ],

and you have to install each of the ones you need as devDependency. To prevent them from executing scripts you can use pnpms onlyBuiltDependencies or neverBuiltDependencies feature or just disable all post-install scripts (thats a safer environment but you might have some deps that depend on it working, put those in onlyBuiltDependencies then

https://pnpm.io/package_json#pnpmonlybuiltdependencies