single-spa icon indicating copy to clipboard operation
single-spa copied to clipboard

Created a new app with create-single-spa but the app will not run standalone

Open spierepf opened this issue 2 years ago • 1 comments

I've created a new single-spa app with npx create-single-spa --framework vue

I run the app using npm run serve:standalone and open a browser on http://localhost:8080.

I expect to see the hello world with big green V that is common to new Vue apps.

Instead, I am greeted by a blank screen, and an error in the console:

Uncaught TypeError: application '@me/my-app' died in status LOADING_SOURCE_CODE: Cannot read properties of undefined (reading 'meta')
    at autoPublicPath (auto-public-path.js:15:29)
    at ./node_modules/systemjs-webpack-interop/auto-public-path/2.js (2.js:3:1)
    at __webpack_require__ (bootstrap:24:1)
    at startup:7:1
    at Object.<anonymous> (startup:8:1)
    at Object.execute (amd.js:48:35)
    at doExec (system.js:469:34)
    at postOrderExec (system.js:465:12)
    at system.js:422:14

You can find the code at https://github.com/spierepf/my-app

Also, this is the vue preset that I used to create the app (in case it helps):

    "test": {
      "useConfigFiles": false,
      "plugins": {
        "@vue/cli-plugin-babel": {},
        "@vue/cli-plugin-typescript": {
          "classComponent": true,
          "useTsWithBabel": true
        },
        "@vue/cli-plugin-eslint": {
          "config": "base",
          "lintOn": [
            "save"
          ]
        },
        "@vue/cli-plugin-unit-jest": {}
      },
      "vueVersion": "2"
    }

spierepf avatar Jun 28 '22 16:06 spierepf

Hello, i had a similar problem, to fix it you need to delete "SystemJSpPublicPathWebpackPlugin" from Webpack 5 which is used in Vue CLI.

// vue.config.js module.exports = { configureWebpack: { output: { libraryTarget: "system", }, }, chainWebpack: (config) => { if (config.plugins.has("SystemJSPublicPathWebpackPlugin")) { config.plugins.delete("SystemJSPublicPathWebpackPlugin"); } }, filenameHashing: false, };

Good luck

DarioDentice avatar Aug 05 '22 16:08 DarioDentice

Hi! It appears there's no more activity on this issue, so I'm going to assume the issue has been resolve and I'm going to close it. Feel free to respond if that's not the case.

eedrah avatar Aug 26 '22 03:08 eedrah