single-spa / single-spa-playground

A website that helps you set up single-spa
http://single-spa-playground.org
MIT License
40 stars 10 forks source link

how do i set the imports url #3

Closed snowlotus closed 5 years ago

snowlotus commented 5 years ago

Data dump

Applications:

[
  {
    "framework": "vue",
    "name": "xubao",
    "pathPrefix": "/xubao"
  }
]

Import map:

{
  "imports": {
    "xubao": "https://unpkg.com/xubao"
  }
}

Description

joeldenning commented 5 years ago

Are you using vue-cli to serve your vue project? Or just a separate webpack config?

The import url should be something like http://localhost:<PORT>/main.js

snowlotus commented 5 years ago

yes,i am using vue-cli to start a demo,and fill the import url http://localhost:8084/#/app.js and start the test,it blocked at the first step and show me the error TypeError: Failed to fetch

joeldenning commented 5 years ago

The # is probably wrong in the url. Try going directly to your URL in a browser tab and see if you can download the js file. Once the js file can be loaded in the browser tab, then you know you've found the right URL.

Also, in regards to Vue, I hope to create a vue-cli plugin for single-spa sometime this week that will make it easier to have vue-cli projects interop with single-spa.

snowlotus commented 5 years ago

ok,thank you . I am looking forward to it

joeldenning commented 5 years ago

Vue CLI plugin created. See https://github.com/CanopyTax/vue-cli-plugin-single-spa and https://single-spa.js.org/docs/ecosystem-vue.html