onebay / vite-plugin-imp

A vite plugin for import library component style automatic.
MIT License
231 stars 24 forks source link

parse importmap in index.html failed #81

Open tjx666 opened 1 year ago

tjx666 commented 1 year ago

Describe the bug

image

image

        <script type="importmap">
            {
                "imports": {
                    "date-fns": "https://esm.dancf.com/npm:date-fns@1.30.1/index.js",
                    "lodash": "https://esm.dancf.com/npm:lodash@4.17.21/lodash.js",
                    "nativebird": "https://esm.dancf.com/npm:nativebird@1.2.9/promise.mjs",
                    "path-to-regexp": "https://esm.dancf.com/npm:path-to-regexp@3.2.0/index.js",
                    "pinia": "https://esm.dancf.com/npm:pinia@2.0.27/dist/pinia.mjs",
                    "qs": "https://esm.dancf.com/npm:qs@6.11.0/dist/qs.js",
                    "vue": "https://esm.dancf.com/npm:vue@2.7.14/dist/vue.runtime.esm.js",
                    "vue-demi": "https://esm.dancf.com/npm:vue-demi@0.13.11/lib/index.mjs",
                    "vue-router": "https://esm.dancf.com/npm:vue-router@3.6.5/dist/vue-router.esm.js",
                    "vuedraggable": "https://esm.dancf.com/npm:vuedraggable@2.24.3/dist/vuedraggable.umd.js"
                },
                "scopes": {
                    "https://esm.dancf.com/": {
                        "@vue/devtools-api": "https://esm.dancf.com/npm:@vue/devtools-api@6.4.5/lib/esm/index.js",
                        "@vue/reactivity": "https://esm.dancf.com/npm:@vue/reactivity@3.2.45/dist/reactivity.esm-bundler.js",
                        "@vue/runtime-core": "https://esm.dancf.com/npm:@vue/runtime-core@3.2.45/dist/runtime-core.esm-bundler.js",
                        "@vue/runtime-dom": "https://esm.dancf.com/npm:@vue/runtime-dom@3.2.45/dist/runtime-dom.esm-bundler.js",
                        "@vue/shared": "https://esm.dancf.com/npm:@vue/shared@3.2.45/dist/shared.esm-bundler.js",
                        "sortablejs": "https://esm.dancf.com/npm:sortablejs@1.10.2/modular/sortable.esm.js",
                        "vue": "https://esm.dancf.com/npm:vue@3.2.45/dist/vue.runtime.esm-bundler.js"
                    }
                }
            }
        </script>

Libarary Info(please complete the following information):

To Reproduce

  1. add importmap to index.html
  2. vite build

Expected behavior

No error when build.

Error message Paste the error message here.

Additional context

What is importmaps: https://github.com/WICG/import-maps

tjx666 commented 1 year ago

Fixed in my self version: https://github.com/tjx666/vite-plugin-imp/commit/598e242fa96d99f829f2150ce1c33625bfbbea7a

psaren commented 1 year ago

Fixed in my self version: tjx666@598e242

PR Welcome!!!