首页 > 解决方案 > HTML 导入每个模块而不是链接导入

问题描述

这是我的电子APP的HTML头。

<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="import" href="importInfo.info">
</head>

这是 importInfo.info 文件。

<meta charset="utf-8">
  <title>HITS</title>
  <script>window.$ = window.jQuery = require('../node_modules/jquery/dist/jquery.min.js');</script>
  <link rel="stylesheet" href="../asset/font-awesome/css/font-awesome.min.css">
  <script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
  <link href="../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="../node_modules/jquery-ui/external/requirejs/require.js"></script> 
  <link href="../asset/css/jquery-ui.css" rel="stylesheet">
  <link href="../asset/css/style.css" rel="stylesheet">
  <script src="../asset/js/frontLib.script"></script>

由于这个错误,我想通过简单的复制和粘贴将其更改为下面的 HTML 在此处输入图像描述

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>HITS</title>
  <script>window.$ = window.jQuery = require('../node_modules/jquery/dist/jquery.min.js');</script>
  <link rel="stylesheet" href="../asset/font-awesome/css/font-awesome.min.css">
  <script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
  <link href="../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
  <script src="../node_modules/jquery-ui/external/requirejs/require.js"></script> 
  <link href="../asset/css/jquery-ui.css" rel="stylesheet">
  <link href="../asset/css/style.css" rel="stylesheet">
  <script src="../asset/js/frontLib.script"></script>
</head>

我一改变

在此处输入图像描述

require.js:166 未捕获的错误:不匹配的匿名定义()模块:函数(){

  return _;
}

发生此错误。

我应该怎么办?我可以简单地保留链接 rel="import" 吗???

它说它计划在 2018 年 3 月左右被移除,所以我很害怕,尽管时间已经过去了。

标签: html

解决方案


推荐阅读