File tree Expand file tree Collapse file tree 2 files changed +9
-65
lines changed
packages/solutions/app-tools/src/plugins/deploy/platforms Expand file tree Collapse file tree 2 files changed +9
-65
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,22 @@ export const createNodePreset: CreatePreset = ({
4040 } ,
4141 async genEntry ( ) {
4242 if ( ! isBundleServer ) {
43- const handlerTemplate = await readTemplate (
44- `node-entry.${ isEsmProject ? 'mjs' : 'cjs' } ` ,
45- ) ;
43+ const handlerTemplate = await readTemplate ( 'node-entry.cjs' ) ;
4644
4745 const code = await generateHandler ( {
4846 template : handlerTemplate ,
4947 appContext,
5048 config : modernConfig ,
5149 } ) ;
5250
53- await fse . writeFile ( entryFilePath , code ) ;
51+ if ( isEsmProject ) {
52+ // We have not test all the packages in esm mode
53+ const cjsEntryFilePath = path . join ( outputDirectory , 'index.cjs' ) ;
54+ await fse . writeFile ( cjsEntryFilePath , code ) ;
55+ await fse . writeFile ( entryFilePath , `import('./index.cjs');` ) ;
56+ } else {
57+ await fse . writeFile ( entryFilePath , code ) ;
58+ }
5459 return ;
5560 }
5661
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments