bootstrap.native: Can't get individual ES6 module loading to work as per wiki page
According to the wiki, you can import only the individual modules you want using ES6 imports. e.g.
import Button from 'bootstrap.native/src/components/button-native.js'
let myBtnInit = new Button('#myBtnID');
However, button-native.js depends on shorter-js:
import { hasClass } from 'shorter-js/src/class/hasClass.js';
import { addClass } from 'shorter-js/src/class/addClass.js';
...
I can’t work out how to get those import paths to work, even for a local deployment, so the browser just gives me TypeError: Error resolving module specifier: shorter-js/src/class/hasClass.js.
Similarly, I can import the whole thing from the CDN via:
import BSN from "//cdn.jsdelivr.net/npm/bootstrap.native@3.0.5/dist/bootstrap-native.esm.min.js";
But the corresponding single-module import doesn’t work:
import Button from "//cdn.jsdelivr.net/npm/bootstrap.native@3.0.5/src/components/button-native.js";
Same problem – can’t resolve the shorter-js dependency.
Is there a build or deploy process I need to go through first to get individual ES6 components to work?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (15 by maintainers)
Checked and the distributed ESM build of modal-native in dist/components works, that’s the one I need so far. I assume if that works the others will.