javascript - 完成项目后“无法获取/”,yarn创建了项目
问题描述
这是终端图片
所以每当我使用yarn init制作我的项目并设置项目然后当我运行| webpack 开发服务器 | 在我的终端中打开我的本地主机 http://localhost:8080 我看到消息“无法获取 /”而不是我调用的函数。
谢谢 :)
index.js
import $ from 'jquery';
import greet from './greet';
$(document).ready(function () {
console.log('jQuery just checked that the DOM is ready!');
});
greet('Boris');
包.json
{
"name": "01-yarn-project",
"version": "1.0.0",
"description": "This project has all the initial yaran started frontend project.",
"main": "index.js",
"repository": "git@github.com:safi-n/yarn-JS-Front-end.git",
"author": "safi-n",
"license": "UNLICENSED",
"private": true,
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^8.2.2",
"babel-preset-es2015": "^6.24.1",
"eslint": "^8.0.1",
"eslint-plugin-react": "^7.26.1",
"webpack": "^5.58.2",
"webpack-cli": "^4.9.0",
"webpack-dev-server": "^4.3.1"
},
"dependencies": {
"jquery": "^3.6.0"
}
}
索引.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="dist/bundle.js"></script>
#tried <script src="bundle.js"></script> too same result
</body>
</html>
解决方案
推荐阅读
- node.js - 如何修复我的部署配置以显示一些代码?
- javascript - 对象未从另一个对象更新对象
- r - tryCatch 和“承诺已经在评估中”
- typescript - Ionic + Typescript - 声明的数组在函数中未定义
- python-3.x - 如何在与 libtorrent/Python 的会话中设置活动下载
- c++ - C++中的线程交错模式
- tensorflow - 如何使用 fit_generator 在 GCP 上训练 Keras 模型
- sql - 每个类别的 SQL 抓取 unque 计数
- php - 登录后如何根据用户在laravel中的角色重定向用户
- php - 实例化所有子类的实例?