Skip to content

Commit 5335dae

Browse files
committed
revert: node server
1 parent 8b12346 commit 5335dae

File tree

2 files changed

+9
-65
lines changed

2 files changed

+9
-65
lines changed

packages/solutions/app-tools/src/plugins/deploy/platforms/node.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff 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

packages/solutions/app-tools/src/plugins/deploy/platforms/templates/node-entry.mjs

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)