We have built a Stencil custom element library. Then, we have built a Stencil application that uses the custom element library. Now, I want to write the spect.ts code but my application is not able to import the custom element library.
- Importing EmailModal gives the following error: “SyntaxError: Cannot use import statement outside a module”
Import {EmailModal;} from @company/custom-elements/dist/components/mail-modal
beforeEach(async () => {
page = await newSpecPage({
components: [EmailDialog, EmailModal],
html: <email-modal-app></email-modal-app>
,
})
page.waitForChanges()
shadowRoot = page.doc
modal = page.doc.querySelector(‘nova-email’)
})
test(‘email modal’, ({given, when, then, and}) => {
given(‘send email’, async () => { if (modal !—null) {
Module.showModal()
}