Skip to content

Support publishing sourcemaps #1

@hajekj

Description

@hajekj

We want to be able to effectively debug PCFs in production without including in-line sourcemap. So the sourcemap should be included with the solution even in production build (it doesn't get loaded in the browser unless F12 Developer Tools are open).

  • Provide custom webpack.config.base.js (sort of a template file) which can be referenced in control's own (based on this for example)
  • Ensure that the the sourcemap is generated for production builds
  • Development builds should use inline sourcemap (so it's easier to load with Fiddler)
  • Ensure the sourcemap is included in the solution
    • It doesn't get included in the solution unless specified in ControlManifest.xml (it's ignored). The only viable way is to specify it as html which is not supported in canvas
    • This has to however be done post pcf-scripts build/rebuild because build outputs are copied to out/ based on manifest, and bundle.js.map gets outputted there directly from webpack
  • Ensure the sourcemap is used when loaded in Power Apps in the browser
  • Document this process into README
  • Ensure our metadata service (INT0014) can provide the sourcemaps via /webresource/* endpoint

The created webpack.config.base.js should look like this. getBuildMode should be also exported.

export const getBuildMode = () => {
    const cliArgs = process.argv;
    const indexOfMode = cliArgs.findIndex(x => x.includes("--buildMode"));
    return cliArgs[indexOfMode + 1].replaceAll("\"", "");
};

export const extendWebpackConfig = (customConfig) => {
    customConfig.devtool = getBuildMode() === "production" ? "source-map" : "inline-source-map";
};

The consumer should be able to use it in their webpack.config.js following way:

import { extendWebpackConfig } from "@talxis/pcf-preset-base/webpack.config.base.js`;

const customConfig = {};
extendWebpackConfig(customConfig);
module.exports = customConfig;

There is an issue with shipping sourcemaps, since all the PCF use the same namespace pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad which can result in conflicting dependency names.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions