Closed xiaohulu closed 5 years ago
@xiaohulu It's an anonymous default export, so that's why it's been given the name _default
.
If you change your code to name the function that is exported then in the types it will reflect that.
import { v, create } from '@dojo/framework/core/vdom';
import * as css from './styles/PageDesigner.m.css';
const factory = create();
const PageDesigner = factory(function PageDesigner() {
return v('h1', { classes: [css.root] }, ['Page Designer']);
});
export default PageDesigner;
It shouldn't make a difference though as it is the default then it can be imported as any name? So once you have built the widget, packaged and installed it into the target project you should be able to import it:
import PageDesigner from 'the-package-name/PageDesigner';
To test this I converted the Button
widget from @dojo/widgets
and installed it into the widget-showcase from @dojo/examples
and everything was working as expected (without having to change any code in the example).
It's my fault. Thank you very much.
I create a function-based widget at "src/PageDesigner.ts"
and add it to .dojorc
then run
dojo build widget --mode dist --target lib
Then generate 3 files at output/dist
But the dist file content is
PageDesigner.d.ts
Not export default PageDesigner So I can not import the PageDesigner widget.
The demo git repo is https://github.com/blocklang/page-designer.git