Git Product home page Git Product logo

Comments (10)

maciej-trebacz avatar maciej-trebacz commented on June 13, 2024 1

@Sebring @toby3d it does work, I needed to copy the contents of _api.js file and paste it into /src/node_modules/api.js, and then also replace import { post } from 'utils.js'; with import { post } from 'api.js'; in three files:

  • src/routes/login/index.svelte
  • src/routes/register/index.svelte
  • src/routes/settings/index.svelte

from realworld.

pjholmes avatar pjholmes commented on June 13, 2024 1

The problem is that src/routes/login/index.svelte makes a call to 'auth/login'. This call is handled on the server, which make a minor adjustment to the JSON and forwards it to the Conduit server (I'm not sure why, perhaps just to demonstrate some providing a server API). The calls in api.js will always prefix that uri with https://conduit.productionready.io/api. So, the calls were going to 'auth/login' on the Conduit server and there is no such URI. I've created a pull request to address this. But there may be a better place to put api.js and utils.js to reduce all of the "../../.." in the relative references.

from realworld.

Sebring avatar Sebring commented on June 13, 2024

You can peek the old file in the repo here before it was deleted.
3c61ad4#diff-17e46da7586caf4f665a809c16049d6b

from realworld.

toby3d avatar toby3d commented on June 13, 2024

@Sebring This does not solve the problem:

Details
> npm run dev

> [email protected] dev /home/toby3d/git/realworld
> sapper dev

• client
'api.js' is imported by src/routes/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_ArticleMeta.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/_Editor.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_Comment.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_CommentInput.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/register/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/settings/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/login/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/[view].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/_Profile.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/ArticlePreview.svelte, but could not be resolved – treating it as an external dependency
• server
'api.js' is imported by src/routes/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/register.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/login.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/auth/save.js, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_ArticleMeta.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/[slug].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/editor/_Editor.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_Comment.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/article/_CommentInput.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/register/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/settings/index.svelte, but could not be resolved – treating it as an external dependency
'utils.js' is imported by src/routes/login/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/[view].svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/profile/[user]/_Profile.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/index.svelte, but could not be resolved – treating it as an external dependency
'api.js' is imported by src/routes/_components/ArticleList/ArticlePreview.svelte, but could not be resolved – treating it as an external dependency
'del' is imported from external module 'api.js' but never used
✔ service worker (34ms)
internal/modules/cjs/loader.js:670
    throw err;
    ^

Error: Cannot find module 'api.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/home/toby3d/git/realworld/__sapper__/dev/server/server.js:13:11)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
> Server crashed

from realworld.

Sebring avatar Sebring commented on June 13, 2024

@toby3d

Did you re-create api.js?

Looks like you need to do the same to util.js

from realworld.

anndream avatar anndream commented on June 13, 2024

@Sebring @toby3d it does work, I needed to copy the contents of _api.js file and paste it into /src/node_modules/api.js, and then also replace import { post } from 'utils.js'; with import { post } from 'api.js'; in three files:

  • src/routes/login/index.svelte
  • src/routes/register/index.svelte
  • src/routes/settings/index.svelte

it ok but can't login

from realworld.

toby3d avatar toby3d commented on June 13, 2024

@m4v3r I reproduce your fixes and find 404 on editor and profile pages.

from realworld.

quantuminformation avatar quantuminformation commented on June 13, 2024

404 on editor page
Screenshot 2019-06-22 at 12 32 49

from realworld.

quantuminformation avatar quantuminformation commented on June 13, 2024

On the live demo

from realworld.

Conduitry avatar Conduitry commented on June 13, 2024

The missing files have been added in da253e4

from realworld.

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.