我的main.css
未呈现,我在webpack.config.js
文件中使用了多个入口点
% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html>
<head>
<meta name='apple-mobile-web-app-capable' content='yes' />
<meta itemprop='name' content='TableGrabber Dashboard'>
{% render_bundle "main" "css" %}
{% render_bundle "vendors~main" "css" %}
<title>
{{ title }}
</title>
我希望我的两个app.js文件都将呈现,并且可以通过将URL放置在浏览器中来运行写入其中的路由
答案 0 :(得分:0)
您忘记将{% render_bundle 'back_office' 'js' %}
放在html文件的正文中
您的文件可能看起来像这样
{% load render_bundle from webpack_loader %}
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- YOU COULD INCLUDE STATIC CSS FILES LIKE ... -->
<link rel="stylesheet" type="text/css" href='{% static "/css/fontawesome5.8.1/all.min.css" %}'>
<link rel="stylesheet" type="text/css" href='{% static "/css/bootstrap4.3.1/bootstrap.min.css" %}'>
<title>YOUR TITLE</title>
{% render_bundle 'first_entry_point' 'css' %}
</head>
<body>
<!-- YOU COULD INCLUDE STATIC JS FILES LIKE JQUERY ... -->
<script src='{% static "/js/jquery-3.4.1.min.js" %}' type="text/javascript"></script>
<script src='{% static "/js/bootstrap4.3.1/bootstrap.bundle.min.js" %}' type="text/javascript"></script>
<div id="react-app" style="height:100%;"></div>
{% render_bundle 'first_entry_point' 'js' %}
</body>
</html>
,在webpack.config.js
中,您可以使用类似
.
.
.
module.exports = {
mode: "development",
entry: {
first_entry_point: path.join(__dirname, "...first_entry_point..."),
second_entry_point: path.join(__dirname, "...second_entry_point...")
},
.
.
.