typescript 宗地-未找到条目

6l7fqoea  于 2022-11-18  发布在  TypeScript
关注(0)|答案(2)|浏览(100)

为什么parcel start会抛出no entries found错误?我在网上查了一下,发现那个包找不到index.html,但我不明白为什么。我在根文件夹中有一个index.html文件。我遗漏了什么吗?

包.json

{
      "name": "meep.io",
      "version": "1.0.0",
      "description": "",
      "main": "index.html",
      "dependencies": {
        "pixi.js": "^5.2.0",
        "typescript": "^3.7.2"
      },
      "devDependencies": {
        "parcel-bundler": "^1.12.4"
      },
      "scripts": {
        "start": "parcel index.html",
        "watch": "parcel watch index.html"
      },
      "keywords": [],
      "author": "",
      "license": "ISC"
    }

索引.html

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
  <!--<![endif]-->
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title></title>
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="" />
    <style>
      body {
        margin: 0px;
        padding: 0px;
        overflow: hidden;
      }
      canvas {
        display: block;
        background: grey;
      }
    </style>
  </head>
  <body>
    <!--[if lt IE 7]>
      <p class="browsehappy">
        You are using an <strong>outdated</strong> browser. Please
        <a href="#">upgrade your browser</a> to improve your experience.
      </p>
    <![endif]-->
    <canvas id="game-canvas"></canvas>
    <script src="./src/app.ts"></script>
  </body>
</html>
idfiyjo8

idfiyjo81#

我使用的是parcel start而不是npm run start

mzaanser

mzaanser2#

在我的例子中,通过package.json放置源代码可以使事情正常工作。

{
   ..  
   "source": "index.html",
   ..
}

具有更多参数的正式文档

相关问题