Giter VIP home page Giter VIP logo

Comments (4)

joeldenning avatar joeldenning commented on May 30, 2024

import-map-overrides inspects the DOM to find all import maps. See https://github.com/joeldenning/import-map-overrides/blob/4ddaa6a507e7221faa93fc1209e2eadeaa7de878/src/api/js-api.js#L194.

What does the following command return for you, in the browser console?

console.log(await importMapOverrides.getDefaultMap())

If it returns an empty import map, then there is either a bug in import-map-overrides or you code does not have proper <script type="systemjs-importmap"> elements in the DOM at the time that import-map-overrides executes.

Perhaps <script src="import-map-overrides.js"></script> is in the incorrect location in the DOM??? See https://github.com/joeldenning/import-map-overrides/blob/master/docs/installation.md#browser

<!--
Make sure to put this BEFORE any <script type="module"> elements or any System.import() calls, but
AFTER all other import maps
-->
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/import-map-overrides/dist/import-map-overrides.js"
></script>

from import-map-overrides.

guguji5 avatar guguji5 commented on May 30, 2024

The return of getDefaultMap is empty.

console.log(await importMapOverrides.getDefaultMap())
{
  imports: {}
  scopes: {}
}

My html is as below. I think I put the import-map-overrides.js in the right place. But it still empty.

<!DOCTYPE html>
  <html>
    <head>
      <meta charset="utf-8" />
      <meta name="viewport" content="width=device-width" />
      <title></title>
      <link href="/layout/layout-52ec262e7e3533d54491.css" rel="stylesheet">
      <script type="text/javascript">
        // 浏览器版本检测,必须是 Chrome 内核并且 >= 80 的版本才支持
        var downloadBrowserPath = '/static/downloadBrowser.html';
        try {
          var match_str;
          var ua_str = navigator.userAgent.toLowerCase();
          var browser_chi_Type = (match_str = ua_str.match(/chrome\/([\d.]+)/)) ? "chrome" : undefined;
          var version = Number(match_str[1].split('.')[0]);

          if (browser_chi_Type !== 'chrome') {
            window.location.href = downloadBrowserPath;
          }
          if (browser_chi_Type === 'chrome' && version < 80) {
            window.location.href = downloadBrowserPath;
          }
        } catch (e) {
          window.location.href = downloadBrowserPath;
        }
      </script>
      <script type="systemjs-importmap">
        {
          "imports": {}
        }
      </script>
      <script src='/static/import-map-overrides.js'></script> <!-- [email protected] source code -->
      <script src='/static/promise-polyfill.min.js'></script>
      <script src='/static/system.min.js'></script>
      <script src='/static/named-exports.min.js'></script>
      <script src='/static/use-default.min.js'></script>
      <script src='/static/amd.js'></script>
      <script src='/static/tinymce/tinymce.min.js'></script>
    </head>
    <body>
      <div id="layout"></div>
      <script src="/layout/layout-52ec262e7e3533d54491.js"></script>  <!-- System.import is called here -->
      <import-map-overrides-full show-when-local-storage="overrides-ui"></import-map-overrides-full>
    </body>
  </html>

from import-map-overrides.

joeldenning avatar joeldenning commented on May 30, 2024

In the html file, the import map is empty. That is why there are no modules. What module are you expecting to show?

from import-map-overrides.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.