javascript - 解决 VueJS 构建和 html-minifiy 的问题
问题描述
我正在尝试构建我的 vuejs 应用程序,但我无法让它工作。我收到以下错误:
$ vue-cli-service build --mode production --dest dist --target app --modern --dashboard
- Building legacy bundle for production...
ERROR Failed to compile with 1 errors3:53:41 PM
ERROR Build failed with errors.
Error: Parse Error: <link rel="stylesheet" href="https://stackpath.bootstrapcd n.com/bootstrap/4.3.1/css/bootstrap.min.css>
<link rel=" icon" href="favicon.ico">
<title>AppTitle</title>
</head>
<body>
<noscript>
<strong>Diese Seite funktioniert nur mit JavaScript. Bitte erlauben sie JavaScript, um die Seite richtig nutzen zu
können.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="/js/chunk-vendors-legacy.c32ef6dd.js"></sc ript><script type="text/javascript" src="/js/app-legacy.f5ccfd09.js"></script> </body>
</html>
- htmlparser.js:240 new HTMLParser
[apptitle]/[html-minifier]/src/htmlparser.js:240:13
- htmlminifier.js:966 minify
[apptitle]/[html-minifier]/src/htmlminifier.js:966:3
- htmlminifier.js:1326 exports.minify
[apptitle]/[html-minifier]/src/htmlminifier.js:1326:16
- index.js:316
[apptitle]/[html-webpack-plugin]/index.js:316:18
我认为问题出在 html-minifier 上,但我的 package-lock.json 中有依赖项。如何将我的应用程序导出到生产环境?
解决方案
如错误消息所述 ( parse error
),您的 HTML 文件中有错误。您似乎忘记关闭href
属性的引号。
<link rel="stylesheet" href="https://stackpath.bootstrapcd n.com/bootstrap/4.3.1/css/bootstrap.min.css <------ Missing quote
推荐阅读
- c# - 如何删除 Windows IoT 中的工具栏?
- google-app-maker - 选择数组中的项目
- prolog - 如何在 Prolog 中捕获回溯(或定界继续)异常?
- xml - 从 VB.NET 中的 XML 文件中提取特定节点
- r - unzip() 正在覆盖文件,即使使用 overwrite = FALSE
- javascript - 如何观察原始 JS ES6 自定义元素中计算的 css 属性的变化
- angular - 外部 Geodaya 语法问题
- git - 如何从 BitBucket git 存储库历史记录中删除带有密码的提交?
- angular - 初始化后将数据传递给 HttpInterceptor
- docker - Docker 缓存 - 即使我删除了 .git 存储库,构建也很大