Parceljs 没有正确捆绑产品?

Parceljs not bundling properly for prod?

我正在测试 parceljs,并且可以很好地用于开发。我有一个正常的 css 来改变背景颜色,还有一个非常简单的 js 文件只是为了看看它是否工作。

css

body {
background-color: lightblue;
}

js

document.getElementById('app').textContent = 'hey'

所以所有这些都在开发模式下工作。但我在 /dist/index.html 上尝试了实时服务器,但我看到的只是裸机 html。没有样式,脚本不呈现。我还尝试了 'parcel build' 命令。和同样的事情。我需要做什么?

package.json

{
  "name": "parceltest1",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "parcel ./src/index.html",
    "build": "parcel build ./src/index.html"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel-bundler": "^1.12.4"
  }
}
Failed to load resource: the server responded with a status of 404 (Not Found)
Refused to apply style from 'http://127.0.0.1:5500/src.e31bb0bc.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled

尝试将“--public-url ./”添加到您的包裹命令中。 更多相关信息:https://github.com/parcel-bundler/parcel/issues/1865