question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@vitejs/app - react-ts - antd-mobile -error

See original GitHub issue

Describe the bug

1

this is no error in dev mode but in production mode, when i was building, i got this message

2

although built sucessfully, but when i use http-server to visit the page, there are some error in console.

Uncaught TypeError: Failed to resolve module specifier “indexof”. Relative references must start with either “/”, “./”, or “…/”. 3

Reproduction

1、use npm init @vitejs/app to generate project from ‘react-ts’ 2、just import sth from antd-mobile 3、npm run build 4、cd dist && httpserver ./

and there will be the message above in console

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
    OS: macOS 11.2.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 264.75 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.16.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 89.0.4389.90
    Safari: 14.0.3
  npmPackages:
    vite: ^2.1.0 => 2.1.2

Used package manager:

Logs

> Uncaught TypeError: Failed to resolve module specifier "indexof". Relative references must start with either "/", "./", or "../".

Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
haha1808656980commented, Mar 31, 2021

I have same problem

2reactions
bluwycommented, Mar 6, 2022

Closing as it’s a dependency issue explained in https://github.com/vitejs/vite/issues/2670#issuecomment-905495115. Thanks for the deep dive @fatso83!

@xubaobao19940428 @sugar0828 I don’t think those issues are related to this. If you have reproduction, please open an issue/discussion for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found