Use a Manifest JS file for dynamic builds
masterTo differentiate between development and production builds, use the --manifest-js option. You must provide a Node.js CommonJS module that exports a function. This function receives an env object (populated by the --env flag) and must return a manifest JSON object.
This allows you to programmatically change IDs, names, or properties like baseUri based on the environment.
module.exports = (env) => {
let [idPostfix, namePostfix] = (env.mode == "development") ? ["-dev", " [DEV]"] : ["", ""];
let manifest = {
manifestVersion: 1,
id: `myextensionidentifier${idPostfix}`,
name: `My Great Extension${namePostfix}`,
...
contributions: [
{
id: "mywidgetidentifier",
properties: {
name: `Super Widget${namePostfix}`,
...
},
...
}
]
}
if (env.mode == 'development') {
manifest.baseUri = "https://localhost:3000";
}
return manifest;
}