Skip to content

Commit

Permalink
Fix #3323 #3424
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo930021 committed Jul 11, 2022
1 parent 5651cd5 commit 59c836e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions server/src/services/typescriptService/preprocess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,26 @@ export function injectVueTemplate(
tsModule.createLiteral(componentFilePath)
);

const createImportSpecifier = (name: string) => {
const [major, minor] = tsModule.version.split('.');
if ((Number(major) === 4 && Number(minor) >= 5) || Number(major) > 4) {
// @ts-expect-error
return tsModule.createImportSpecifier(undefined, undefined, tsModule.createIdentifier(renderHelperName));
}
return tsModule.createImportSpecifier(undefined, tsModule.createIdentifier(name));
};

// import helper type to handle Vue's private methods
const helperImport = tsModule.createImportDeclaration(
undefined,
undefined,
tsModule.createImportClause(
undefined,
tsModule.createNamedImports([
tsModule.createImportSpecifier(undefined, tsModule.createIdentifier(renderHelperName)),
tsModule.createImportSpecifier(undefined, tsModule.createIdentifier(componentHelperName)),
tsModule.createImportSpecifier(undefined, tsModule.createIdentifier(iterationHelperName)),
tsModule.createImportSpecifier(undefined, tsModule.createIdentifier(componentDataName))
createImportSpecifier(renderHelperName),
createImportSpecifier(componentHelperName),
createImportSpecifier(iterationHelperName),
createImportSpecifier(componentDataName)
])
),
tsModule.createLiteral('vue-editor-bridge')
Expand Down

0 comments on commit 59c836e

Please sign in to comment.