dojo / cli-build-widget

Command for building Dojo widgets
Other
6 stars 17 forks source link

When has one widget, index.d.ts was generated to the root folder #65

Closed xiaohulu closed 4 years ago

xiaohulu commented 4 years ago

I have a dojo project which has one widget

src
    page
        index.tsx
        index.m.css
        index.m.css.d.ts
.dojorc
package.json

then run dojo build widget --mode dist --target lib, the generate files are

output
    dist
        index.d.ts
        page
            index.mjs
            index.mjs.map
            ...

then I import the Page in another project, throw errors.

// Module not found: Error: Can't resolve 'project1' in 'xx\project1\src\page'
import Page from 'project1';
// can not wirte to below, because the page folder not contain `*.d.ts`
import Page from 'project1/page';

the index.d.ts should be in page folder, not in the root folder.

Note:If has two widgets, the output is right

agubler commented 4 years ago

@xiaohulu Thanks for the issue, I had noticed this before but wasn't sure what the cause was (thought it was something related to me as widgets built correctly). But yeah it seems building a single widget causes the d.ts file to be placed in the root unfortunately. Will work on a fix for this. Thanks.