Skip to content

Why does this bug appear when I use this vue-cli demo :Reason: ScriptExternalLoadError: Loading script failed. #2066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
flamingoTwoWings opened this issue Jul 9, 2022 · 6 comments

Comments

@flamingoTwoWings
Copy link

image

@cp3hnu
Copy link

cp3hnu commented Jul 10, 2022

You may need to modify the configuration of optimization.splitChunks

optimization: {
  splitChunks: false
}

or

chainWebpack: config => {
  config.optimization.delete('splitChunks')
}

@ScriptedAlchemy
Copy link
Member

Output.PublicPath: auto

@nuno-barreiro
Copy link

Setting any of those options didn't work in the project I started based on the vue-cli demo.
However, it seems there are further issues related to the vue-cli such as here: vuejs/vue-cli#6823

@ScriptedAlchemy
Copy link
Member

It's related to webpack trying to load chunks from the wrong url. Usually when public path is set to a relative like / - Audi usually fixes it otherwise you can hard code public path to an absolute location and it should work

@nuno-barreiro
Copy link

Thanks @ScriptedAlchemy. I've disabled splitChunks and set the publicPath, and it works now. Great!
My vue.config.js now has this settings:

publicPath: 'http://localhost:5001',
  transpileDependencies: true,
  configureWebpack: {
    optimization: {
      splitChunks: false,
    },
    plugins: [
      new ModuleFederationPlugin({
        name: "products",
        filename: "remoteEntry.js",
        library: { type: "var", name: "products" },
        exposes: {
          "./ListingComponent": "./src/components/ProductsListing.vue",
        },
      }),
    ],
  },
  devServer: {
    port: 5001,
  },

@ScriptedAlchemy
Copy link
Member

Awesome glad to hear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants