23/04/12学习回顾:
以下报错是因为ejs模板引擎,ejs语法就是<%= %>,并且在注释中也会解析


在cli中运行 npm run serve 遇见的error :
1 ERROR in child compilations (Use ‘stats.children: true’ resp. ‘–stats-children’ for more details)

  1. 在网上搜索error信息,找到以下文章
    https://blog.csdn.net/coralpapy/article/details/119383767
  2. 文章中提了一句相关error解释
    需要特别留意html模板的所在文件的绝对路径,否则会报错找不到
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
//文件路径错误报错
  1. 于是定位error应该是由于public里面的index.html 里面
  2. 通过部分复制粘贴与源码的对比,发现在问题处在注释里面<%= %>,导致模板解析时出问题.
<head>
    <!-- 配置页签的图标,当项目实施时可能有各种路径问题,cli因此在这里把./和/转化成<%= %>,底层有一定处理-->
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <!-- 配置网页的标题<%= %> 中的内容代表来到package.json中找到name对应的名称=>webpack插件的一个功能 -->
    <title><%= htmlWebpackPlugin.options.title %></title>
</head>
  1. 之后学习中应该注意解释内容
Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐