Closed madeInLagny closed 4 years ago
I would do it the other way, if I already have a configured webpack then I would just import the module import Dropdown from './components/dropdown-native.js'
or if I want to build a bundle, I would comment out all the other modules and run the npm run build
command. And used the build result from the dist folder
@madeInLagny we replaced all build tools with rollup and the wiki is out of date.
Stick around, the current build tools will have a new update very soon.
@madeInLagny I have a new build script, currently working on it's logic to make it more flexible.
Example src/index.custom.js
import {initCallback,removeDataAPI} from './util/callbacks.js' // OPTIONAL if you use your own init scripting
import {componentsInit} from './util/globals.js' // OPTIONAL if you use your own init scripting
import {version as Version} from './../package.json'
import { one } from './util/event.js'
import Alert from './components/alert-native.js'
// add more components you need HERE
// OPTIONAL if you use your own init scripting
componentsInit.Alert = [ Alert, '[data-dismiss="alert"]']
// add other components similarly here
// bulk initialize all components
// OPTIONAL if you use your own init scripting
document.body ? initCallback() : one( document, 'DOMContentLoaded', initCallback );
export default {
Alert,
initCallback, // OPTIONAL if you use your own init scripting
removeDataAPI, // OPTIONAL if you use your own init scripting
componentsInit, // OPTIONAL if you use your own init scripting
Version
}
And the CLI script
npm run custom INPUTFILE:src/index.custom.js,OUTPUTFILE:dist/bootstrap-native-custom.js,MIN:false,FORMAT:umd
How about that?
I'm now currently working on a way to include ONLY util functions that are used by requested components and not ALL by default.
Cheers
@madeInLagny and @cvaize the new build script is now online, check it out.
I've updated the above guide accordingly and will link to it as a temporary guide for future queries.
Talk to you soon.
@thednp, thanks for the updated build script and explanation, it works great for me.
Hello, I want to build the dropdown module only. I downloaded the code and ran
node build.js --bs_version 4 --minify --only dropdown
from root. I got the following error:Cannot find module 'C:\Users\...\bootstrap.native-master\build.js
What am I missing ?