Closed eMuonTau closed 2 years ago
Hi @eMuonTau, there are two files in the dist folder, the one that you are trying to use only exports the custom element, in case you want to register it with a different name. The other one (the main), register the component with its standard name.
Example:
import '@alenaksu/json-viewer';
// OR
import '@alenaksu/json-viewer/dist/json-viewer.js';
Or if you want to register the component with a different tag:
import { JsonViewer } from '@alenaksu/json-viewer/dist/JsonViewer.js';
customElements.define('my-tree-view', JsonViewer);
In general I think you can just omit the path from the script url (eg https://unpkg.com/@alenaksu/json-viewer@1.0.1
)
Hi @alenaksu, I am sure i tried json-viewer.js as module. It was not working. I will try again and let you know.
Maybe I missed something then, this is the link of the fiddle I created https://jsfiddle.net/kyvo94ct/
Hi @alenaksu you did not miss anything. I am using Blazor and after i rebuilt the project a few times it worked. As i said i was sure i tried json-viewer.js. Thanks for your help and sorry for taking your time.
No problem at all, I'm glad I could help
Describe the bug After 1.0.0 json view is not rendered in browser with following error.
Error message indicates that it is an ESM module and i tried to add
type="module"
attribute to script tag but it did not work too. I couldn't find anyhing about ESM change in releases page and readme. Then i tried to use index.js file from demo and it worked withtype="module
attribute. I think demo is using a custom file. It would be better to use latest distributed file in demo to detect issues early.To Reproduce Steps to reproduce the behavior:
Link to Minimal Reproducible Example
Expected behavior It should render tree view