3

What is the JavaScript equivalent to styleUrl? For importing CSS, it's:

@Component({
  tag: 'my-random-component',
  styleUrl: '../../index.scss',
  shadow: true
})

What if I want to import JavaScript instead? I could not find anything about JavaScript in the Stencil documentation.

I have heard that JS is written inside index.ts file, and I did, but nothing happens. The function that I imported in my index.ts is not being invoked.

happy_story
  • 1
  • 1
  • 7
  • 17

1 Answers1

1

In the stencil.config.ts, add: globalScript: 'src/index.ts' below the namespace.

JS can be written inside index.ts.

happy_story
  • 1
  • 1
  • 7
  • 17