You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script>
console.log($);
alert($.capital("hridayesh"))
$.addDOMContent("It works I think!!!")
</script>
Indeed, that works fine. But I'm wondering, how it would have to look like, if I externalize this functionality into a separate module "index.js" at the "index.html" directory level.
I can't make the import run. Could you elaborate please?
index.js:
import capital from './dist/index_bundle.js'
alert(capital("hridayesh"))
First attempt:
index.html:
<script src="dist/index_bundle.js"></script>
<script src="index.js"></script>
<!-- <script>
console.log($)
alert($.capital("hridayesh"))
$.addDOMContent("Well It Works Fine!!!")
</script> -->
Browser error:
Cannot use import statement outside a module
Second attempt:
index.html:
<script src="dist/index_bundle.js"></script>
<script type="module" src="index.js"></script>
<!-- <script>
console.log($)
alert($.capital("hridayesh"))
$.addDOMContent("Well It Works Fine!!!")
</script> -->
Browser error:
The requested module './dist/index_bundle.js' does not provide an export named 'default'
The text was updated successfully, but these errors were encountered:
Indeed, that works fine. But I'm wondering, how it would have to look like, if I externalize this functionality into a separate module "index.js" at the "index.html" directory level.
I can't make the import run. Could you elaborate please?
index.js:
First attempt:
index.html:
Browser error:
Cannot use import statement outside a module
Second attempt:
index.html:
Browser error:
The requested module './dist/index_bundle.js' does not provide an export named 'default'
The text was updated successfully, but these errors were encountered: