vue-cli-plugin-single-spa icon indicating copy to clipboard operation
vue-cli-plugin-single-spa copied to clipboard

webpack5 Uncaught TypeError: application 'xxx' died in status LOADING_SOURCE_CODE: Cannot read properties of undefined (reading 'meta') at autoPublicPath

Open Jarryxin opened this issue 3 years ago • 3 comments

after upgrade vue webpack5... error occurred.

(set libraryTarget = umd) https://github.com/single-spa/vue-cli-plugin-single-spa/blob/main/index.js#L26

npm run serve:standalone

invoked SystemJSPublicPathWebpackPlugin (https://github.com/single-spa/vue-cli-plugin-single-spa/blob/main/index.js#L33)

inner invoked

https://github.com/joeldenning/systemjs-webpack-interop/blob/main/auto-public-path/auto-public-path.js#L15

此处 __system_context__undefined,报错

image

Currently, I change vue.config.js, fllow:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  chainWebpack: config => {
    config.output.libraryTarget("system")
  },
})

Jarryxin avatar May 23 '22 08:05 Jarryxin

reproducing repo: https://github.com/Jarryxin/vue-spa-app

Jarryxin avatar May 23 '22 08:05 Jarryxin

@Jarryxin I was dealing with the same error after upgrading to v5 of the Vue CLI. Since it apparently uses Webpack 5, I don't think the SystemJSPublicPathWebpackPlugin is needed.

The following seemed to solve the error for me:

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

rrjohnson85 avatar Jun 02 '22 13:06 rrjohnson85

@Jarryxin I was dealing with the same error after upgrading to v5 of the Vue CLI. Since it apparently uses Webpack 5, I don't think the SystemJSPublicPathWebpackPlugin is needed.

The following seemed to solve the error for me:

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

thank you!!! delete SystemJSPublicPathWebpackPlugin, it works. love you!!

Roned avatar May 18 '23 07:05 Roned