【发布时间】:2020-02-28 13:45:24
【问题描述】:
我正在测试 parceljs,并且适用于开发。我有一个普通的 css 来改变背景颜色,还有一个非常简单的 js 文件来看看它是否工作。
css
body {
background-color: lightblue;
}
js
document.getElementById('app').textContent = 'hey'
所以所有这些都在开发模式下工作。但我在 /dist/index.html 上尝试了实时服务器,我看到的只是裸 html。没有样式,并且脚本不会呈现。我还尝试了“包裹构建”命令。和同样的事情。我需要做什么?
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
【问题讨论】:
标签: javascript parceljs