-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
Snippet from my index.ts file in a v2/vite addon, as per typed-ember/glint#628
// src/index.ts
export { default as Popover } from './components/popover.gts';
export { default as popover } from './helpers/popover.ts';Extensions are included for the import paths. Transpiling to js in dist works just fine.
But my declarations are broken, using rollup --config:
// rollup.config.mjs
const configs = {
babel: resolve(import.meta.dirname, './babel.publish.config.mjs'),
ts: resolve(import.meta.dirname, './tsconfig.publish.json')
};
export default {
output: addon.output(),
plugins: [
// ... snip
// Emit .d.ts declaration files
// apparently, running glint this way does something other than running
// glint itself on the CLI. Manually running it generates the types
// appropriately. Running it as param here will produce broken declarations
// It strips the `.gts` from the imports.
addon.declarations('declarations', `glint --declaration --project ${configs.ts}`),
]
};Here is the output:
// declarations/index.d.ts
export { default as Popover } from './components/popover';
export { default as popover } from './helpers/popover.ts';So I tried running glint --declaration --project tsconfig.publish.json manually... and this is the result:
// declarations/index.d.ts
export { default as Popover } from './components/popover.gts';
export { default as popover } from './helpers/popover.ts';Huh?
At this point I dunno what is happening 😵💫
I did this: addon.declarations('declarations', 'which glint')
That assured me, the glint from node_modules in the package is used.
Workaround
As a workaround, comment out addon.declarations() and move it to package.json:
{
"scripts": {
"build": "pnpm run '/^build:.*/'",
"build:js": "rollup --config",
"build:declarations": "glint --declaration --project tsconfig.publish.json",
}
}Metadata
Metadata
Assignees
Labels
No labels