Giter Site home page Giter Site logo

Sveltekit: New app errors about nx-extensions HOT 4 OPEN

strenkml avatar strenkml commented on May 23, 2024 2
Sveltekit: New app errors

from nx-extensions.

Comments (4)

guernica0131 avatar guernica0131 commented on May 23, 2024 1

Has this issue been resolved? I have the exact same issue and can't find a workable solution. Under no condition is it practical to have src in root for a micro service application

from nx-extensions.

dgrbrady avatar dgrbrady commented on May 23, 2024

+1 to this, I'm seeing this as well. Also thought I'd mention that running the serve executor yields the same "src/app.html" does not exist error. And when I go to localhost:4200 I get this error logged to the console:

ailed to load url /.svelte-kit/generated/server/internal.js (resolved id: /.svelte-kit/generated/server/internal.js). Does the file exist?
12:15:09 PM [vite] Error when evaluating SSR module /node_modules/@sveltejs/kit/src/runtime/server/index.js: failed to import "/.svelte-kit/generated/server/internal.js"
|- Error: Failed to load url /.svelte-kit/generated/server/internal.js (resolved id: /.svelte-kit/generated/server/internal.js) in /path/to/my/nx/workspace/node_modules/@sveltejs/kit/src/runtime/server/index.js. Does the file exist?
    at loadAndTransform (file:///path/to/my/nx/workspace/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:53376:21)

Not sure if the 2 are related, but guidance or suggestions is greatly appreciated! I'm on ubuntu and am trying to generate a sveltekit app under my apps/* directory.

Output from nx report:

  Node   : 18.16.1
   OS     : linux-x64
   npm    : 9.5.1
   
   nx                 : 17.0.1
   @nx/js             : 17.0.1
   @nx/jest           : 17.0.1
   @nx/linter         : 17.0.1
   @nx/eslint         : 17.0.1
   @nx/workspace      : 17.0.1
   @nx/cypress        : 17.0.1
   @nx/devkit         : 17.0.1
   @nx/eslint-plugin  : 17.0.1
   @nrwl/tao          : 17.0.1
   @nx/vite           : 17.0.1
   typescript         : 5.1.6
   ---------------------------------------
   Community plugins:
   @nxext/svelte     : 17.0.1
   @nxext/sveltekit  : 17.0.1
   @wanews/nx-pulumi : 0.27.0

from nx-extensions.

Jedliu avatar Jedliu commented on May 23, 2024

@dgrbrady delete the .svelte-kit folder and restart the server or the vscode. The following problem will be solved.

Failed to load url /.svelte-kit/generated/server/internal.js

The files in the .svelte-kit should be like this
image

Copy the folders src and static from apps/your-sveltekit-app/ to the root. The following problem will be solved.

src\app.html does not exist
image

But the folder structure is not supposed to be like this.

When the server starts, there is a message:

The following Vite config options will be overridden by SvelteKit:
  - root

The server is loaded from the default source path. I tried to update the svelte.config.js to assign the new files path, but it doesn't work. This config file wasn't loaded at all.
I move the svelte.config.js to the root of the nx file path. It was loaded then.

I'm still checking how to fix this. Hope someone could advise the right path. Thank you!

from nx-extensions.

Jedliu avatar Jedliu commented on May 23, 2024

To make the svelte.config.js work in the root of the NX project, I have to add "type": "module", in the package.json which will break other NX apps. Here I attach thesvelte.config.js file.

Looking for a working solution.

import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
  // Consult https://kit.svelte.dev/docs/integrations#preprocessors
  // for more information about preprocessors
  preprocess: vitePreprocess(),

  kit: {
    // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
    // If your environment is not supported or you settled on a specific environment, switch out the adapter.
    // See https://kit.svelte.dev/docs/adapters for more information about adapters.
    adapter: adapter(),
    files: {
      routes: 'apps/web/src/routes',
    }
  },
};

export default config;

from nx-extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.