#Load individual components in Vanilla Js

1 messages · Page 1 of 1 (latest)

rich canyon
#

I want to load or define single component instead of

<script type="module" src="dist/ds-components/components.esm.js"></script>

with framewroks i could able to define individual compoennts like this

import { defineCustomElement as dsButton } from 'ds-components/dist/components/ds-button';

dsButton();

I want to do it same for html like

    <script type="module">
        import { defineCustomElement as dsButton } from 'ds-components/dist/components/ds-button.js';
        dsButton();
    </script>

somehow this is not working, does anyone using this with js project

rich canyon
#

if making this config then working, not sure this brings any side effects, any suggestions @hot fable

        {
            type: 'dist-custom-elements',
            externalRuntime: false,
        },

actually i want to support my consumers to define single element on their own with framework or without

even moved stencil/core to dependecies with externalRuntime: true gives runtime error but document says, this will prevent runtime errors https://stenciljs.com/docs/custom-elements#externalruntime

error

Uncaught TypeError: Failed to resolve module specifier "@stencil/core/internal/client". Relative references must start with either "/", "./", or "../".
rich canyon
unreal garden
#

@rich canyon hey 👋 do you have a reproducible example by any chance?