What is in the index.js file?
Laravel Mix - expose function to be used in browser
I have a typescript file that I would like to build with mix, and then use it in another page as a javascript library. i.e:
<script type="module" src="/js/index.js">
console.log("test");
</script>
How can I achieve this with mix?
I was able to use mix.ts('resources/index.ts', 'public/js') to create the file, but all attempts to use the functions inside the file:
i.e:
import getInfo from '/js/index.js'
import {getInfo} from '/js/index.js'
all result in similar errors: The requested module '/js/index.js' does not provide an export named 'default', The requested module '/js/index.js' does not provide an export named 'getInfo'
When I look in js/index.js I can actually see the methods that I want to use, so I know they were somewhat exported. But I'm not sure how I can actually use the function.
I've checked the window variable and the functions are also not there.
Thank you
Please or to participate in this conversation.