Since pcf-scripts switched to Webpack 5 in version 1.10.4. there is a problem if a component is used in a Dynamics 365 mobile app - like the Dynamics 365 Field Service mobile app. The user only sees a "Error loading control". The detail error dialog shows further: "Error occured during initialization of control: {Name} Message: Could not find/invoke {Name} constructor." This is because the component fails to register itself, due to an earlier Webpack exception:
"Automatic publicPath is not supported in this browser"
It only happens in mobile apps, because Webpack can't resolve any public path in the WebView environment.
There is a fix. The "webpackConfig.js" can be modified so that there is a default empty public path.
output: {
// This library value control what global variable the output control is placed in.
library: constants.TEMP_NAMESPACE,
pathinfo: true,
filename: constants.BUNDLE_NAME,
path: controlOutputDir,
publicPath: '' // fixes "Automatic publicPath is not supported in this browser" exception
},
With this set the component does work again in mobile apps. It also works if we use the "pcfAllowCustomWebpack" feature and set the publicPath in our custom webpack config.
module.exports = {
output: {
publicPath: ""
}
}
But I think this should be released in the default "webpackConfig.js" of the pcf-scripts package.
WarrenBelz
94
Most Valuable Professional
Michael E. Gernaey
72
Super User 2025 Season 1
mmbr1606
71
Super User 2025 Season 1