Skip to content

Commit

Permalink
Fix bug for configureWebpack.output = 'auto'
Browse files Browse the repository at this point in the history
For module-federation need to use output auto
```javascript
const { defineConfig } = require('@vue/cli-service')
const webpack = require('webpack')

module.exports = defineConfig({
  configureWebpack: {
    output: {
      publicPath: 'auto', // <- ERROR: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead.
    },
    optimization: {
      splitChunks: false,
    },
    plugins: [
      new webpack.container.ModuleFederationPlugin({
        name: 'vue_cli_demo',
        filename: 'remoteEntry.js',
        exposes: {
          './HelloWorld.vue': './src/components/HelloWorld.vue',
        },
        shared: {
          vue: {
            singleton: true,
          },
        },
      }),
    ],
  },
  transpileDependencies: true
})
  • Loading branch information
AndreiSoroka committed Feb 21, 2022
1 parent f7dc46d commit 64933b2
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = function validateWebpackConfig (
)
}

if (target === 'app' && singleConfig.output.publicPath !== options.publicPath) {
if (target === 'app' && ![options.publicPath, 'auto'].includes(singleConfig.output.publicPath)) {
throw new Error(
`\n\nConfiguration Error: ` +
`Avoid modifying webpack output.publicPath directly. ` +
Expand Down

0 comments on commit 64933b2

Please sign in to comment.