Better handling of publicPath: 'auto'#7005
Conversation
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
})
|
https://next.cli.vuejs.org/config/#publicpath VueConfig has option for this. |
|
@hansonfang But... I'm checking at the moment, seems MF is working... Last time it confused me and I went looking for a workaround |
This reverts commit 64933b2.
|
@hansonfang updated MR |
|
@hansonfang what do you think about current Mr? (after update) |
|
FYI: @sodatea ? |
|
@AndreiSoroka sorry I'm not member of contributor group. Maybe ask others to determine. |
haoqunjiang
left a comment
There was a problem hiding this comment.
Thanks for the PR.
But I think there are still many places that we need to fix for publicPath: 'auto' to work correctly.
For example, process.env.BASE_URL should be set to '' in this case. So does the baseUrl argument for genHistoryApiFallbackRewrites.
After applying those changes, I think it would be more consistent to replace the options.publicPath here with process.env.BASE_URL, too.
|
thanks. I will update mr on this week |
|
@sodatea Hi, can you re-review the code? |
publicPath: 'auto'
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
Other information:
For module-federation need to use output auto
Fix problem for
after that I'll add example here