Skip to content

Commit

Permalink
npm builds should not use wrapper (#35766)
Browse files Browse the repository at this point in the history
  • Loading branch information
caroqliu committed Aug 23, 2021
1 parent ab41a55 commit 68b7333
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build-system/tasks/extension-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const ExtensionOptionDef = {};
* outfile: string,
* external?: Array<string>
* remap?: Record<string, string>
* wrapper?: string,
* }}
*/
const ExtensionBinaryDef = {};
Expand Down Expand Up @@ -625,6 +626,7 @@ function buildNpmBinaries(extDir, options) {
outfile: preact,
external: ['preact', 'preact/dom', 'preact/compat', 'preact/hooks'],
remap: {'preact/dom': 'preact'},
wrapper: '',
});
}
if (react) {
Expand All @@ -638,6 +640,7 @@ function buildNpmBinaries(extDir, options) {
'preact/hooks': 'react',
'preact/dom': 'react-dom',
},
wrapper: '',
});
}
return buildBinaries(extDir, binaries, options);
Expand All @@ -655,7 +658,7 @@ function buildBinaries(extDir, binaries, options) {
mkdirSync(`${extDir}/dist`);

const promises = binaries.map((binary) => {
const {entryPoint, external, outfile, remap} = binary;
const {entryPoint, external, outfile, remap, wrapper} = binary;
const {name} = pathParse(outfile);
const esm = argv.esm || argv.sxg || false;
return esbuildCompile(extDir + '/', entryPoint, `${extDir}/dist`, {
Expand All @@ -666,6 +669,7 @@ function buildBinaries(extDir, binaries, options) {
outputFormat: esm ? 'esm' : 'cjs',
externalDependencies: external,
remapDependencies: remap,
wrapper: wrapper ?? options.wrapper,
});
});
return Promise.all(promises);
Expand Down

0 comments on commit 68b7333

Please sign in to comment.