Showing results for 
Search instead for 
Did you mean: 
New Member

Component fails in mobile apps because of missing Webpack publicPath

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.


Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (5,238)