На самом деле у меня есть следующие записи config
const entries = {
'main' : [
require.resolve('react-dev-utils/webpackHotDevClient'),
paths.appIndexJs,
],
'navbar': [paths.navbarIndexJs],
};
В плагины я запускаю HtmlWebpackPlugin следующим образом:
plugins: [
new HtmlWebpackPlugin(
Object.assign(
{},
{
chunks: ["main", "navbar"],
inject: true,
// template: paths.appHtml,
filename: '../tmp/board.html',
},
isEnvProduction
? {
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
}
: undefined
)
),
Я уже создал целый html файл (У меня есть их копия в файле tmp / board. html), и я не хочу использовать шаблон для создания нового файла.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Web site created using create-react-app" />
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap&subset=latin-ext" rel="stylesheet">
<link rel="stylesheet" href="./App.css">
<link rel="manifest" href="/manifest.json" />
<title>Admin Board</title>
<link href="/static/css/navbar.[hash].css" rel="stylesheet">
</head>
<body>
<nav id="ReactNavbar"></nav>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/static/js/navbar.[hash].js"></script>
<!-- whole html file content goes here.... -->
</body>
</html>
Сгенерированные файлы:
632 B build\static\js\navbar.48392b.js
202 B build\static\css\navbar.ea003b8e.css
Вопрос:
Как я могу просто добавить активы, сгенерированные в этот существующий файл ??
Вместо <script src="/static/js/navbar.[hash].js"></script>
например