Skip to content

Commit

Permalink
fix(compiler): custom elements relative typedef import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduy1407 committed Dec 4, 2023
1 parent 8c10e8b commit 055678b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ const generateCustomElementsTypesOutput = async (
const localComponentTypeDefFilePath = `./${component.tagName}`;

return [
`export { ${importName} as ${exportName} } from '${componentDTSPath}';`,
`export { ${importName} as ${exportName} } from '${
componentDTSPath.startsWith('.') ? componentDTSPath : './' + componentDTSPath
}';`,
// We need to alias each `defineCustomElement` function typedef to match the aliased name given to the
// function in the `index.js`
`export { defineCustomElement as ${defineFunctionExportName} } from '${localComponentTypeDefFilePath}';`,
Expand Down Expand Up @@ -206,8 +208,6 @@ const generateCustomElementType = (componentsDtsRelPath: string, cmp: d.Componen
*/
const relDts = (fromPath: string, dtsPath: string): string => {
dtsPath = relative(fromPath, dtsPath);
if (!dtsPath.startsWith('.')) {
dtsPath = '.' + dtsPath;
}
return normalizePath(dtsPath.replace('.d.ts', ''));

return normalizePath(dtsPath.replace('.d.ts', ''), true);
};

0 comments on commit 055678b

Please sign in to comment.