How to use this plugin on node + vite bundle when using with type module
Newbie here. Sorry for disturbing.
Trying to use this plugin with node using vite as bundler after npm install .. ¿how do i proceed to use the plugin?
Tried with
import { showToast } from 'bootstrap';
or
import bootstrap from 'bootstrap' ;
but on build always get same error:
error during build: RollupError: "default" is not exported by "node_modules/bootstrap/dist/js/bootstrap.esm.js", imported by...
Been googling around but cannot figure out how to find the answer
Thank you very much
Hi @cancrexo, because showToast is not an ES6 module you could just import the file with import "./src/bootstrap-show-toast.js", then you should be able to bootstrap.showToast().
<script type="module">
import "./src/bootstrap-show-toast.js"
document.getElementById("button-show-simple").addEventListener("click", function () {
bootstrap.showToast({body: "Hello Toast!"})
})
</script>
Thank you very much!. Will give it a try tonite.