我正在尝试通过"scripts":{"start": "parcel docs/demo_world.html"}
package.json 文件中的 Parcel 脚本运行 jQuery maphilight 插件演示。我正在使用从https://github.com/kemayo/maphilight下载的 maphilight 演示项目,该项目使用实时服务器运行良好,但是当我使用上面的 Parcel 脚本时,我在开发工具中收到以下错误:
我刚刚获取了上面链接中的 maphilight 演示,运行npm i parcel-bundler --save-dev
并在下面的 package.json 文件中添加了脚本。
这甚至可以通过包裹实现吗?任何信息,将不胜感激!谢谢你。
完整的 package.json 看起来像:
{
"name": "maphilight",
"version": "1.4.2",
"title": "maphilight",
"author": {
"name": "David Lynch",
"email": "kemayo@gmail.com",
"url": "http://davidlynch.org"
},
"repository": "https://github.com/kemayo/maphilight.git",
"licenses": [
{
"type": "MIT",
"url": "MIT-LICENSE.txt"
}
],
"dependencies": {
"jquery": "^3.0.0"
},
"scripts": {
"start": "parcel docs/demo_world.html",
"build": "parcel build docs/demo_world.html --public-url.",
"build:archive": "ch5-cli archive -p npm_practice_v1 -d dist -o output"
},
"description": "a plugin that adds visual hilights to image maps",
"keywords": [
"map",
"imagemap",
"hilight",
"highlight",
"jquery-plugin",
"ecosystem:jquery"
],
"homepage": "https://github.com/kemayo/maphilight",
"main": "jquery.maphilight.min.js",
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"parcel-bundler": "^1.12.5"
}
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery maphilight documentation</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../jquery.maphilight.min.js"></script>
<script type="text/javascript">$(function() {
$('.map').maphilight({fade: false});
});</script>
</head>
<body>...
</body>
</html>