The last discussion on this subject is some 3 months old, so I was hoping that by now, creating a CLI generated Typescript-Webpack 4 application that uses Bootstrap would be a breeze. However after spending a couple of hours trying to get it to work, I realized that it might be smarter to ask whether this error message:
ERROR in ./node_modules/bootstrap/dist/js/bootstrap.js
Module not found: Error: Can't resolve 'popper.js' in 'C:\work\FEC-samples\FEC-test-sample\node_modules\bootstrap\dist\js' @ ./node_modules/bootstrap/dist/js/bootstrap.js 7:101-121
@ multi (webpack)-dev-server/client?http://localhost:8080 bluebird jquery bootstrap
means something to folks that got this to work.
There are two places where bootstrap appears in project configuration files (note that aurelia.json file has no dependencies information when using the webpack as the loader/bundler).
I am not sure about the need to install popper.js I did try that and got a ton of runtime error messages. I also found several explanations that popper.js is bundled with bootstrap since its release, so it does not need to be installed separately.
popper.js and jquery are included in bootstrap.bundle.js which is not the file used when you import âbootstrapâ, so unless youâre using an alias for âbootstrapâ to point to that file, you need to install both jquery and popper.js.
My turn to say sorry - but for different reason: I fail to see the connection between my preference for a different way to generate the Aurelia Dotnet distributed app and the problem I am having with Webpack 4 - Bootstrap 4 configuration. Would you mind to explain?
In Webpack, I use code splitting which is offered by setting a second parameter in all calls to PLATFORM.moduleName('path/to/view', 'bundlename') and then a simple entry, optimization parameters (loaders not shown)
Thank you @MaximBalaganskiy and @mp24 for trying to help me. Your solutions are too far away from what I am trying to achieve: make Aurelia CLI created app to use Bootstrap 4 and Webpack 4. The term âAurelia CLI created appâ means that I want to use the webpack.config.js that is created by the CLI tool - like this one.
Once I realized that most of my problems were caused by using popper, instead of the required popper.js (Duh), my current situation is best defined by this screenshot:
Feeling lazy, I made this post expecting some idea to quickly fix this (instead of debugging the âview-onlyâ nav-bar.html). The most likely reason for this problem is that some of the css clssses in the nav-bar.html definition
There are breaking changes between Bootstrap 3.3.7 and 4.*, and navbar is one of the main ones. Unfortunately, BS4 is not a drop-in replacement. You would need to adapt your HTML code.
Thanks, @mp24 - I agree with your conclusion and have found a better way to address this (better than replacing the parts of nav-bar without really knowing what to replace and what the replacement should be).
I am looking at this webpack.config.js and this navbar.html - as this Navigation Skeleton sample is very close to what I am doing (CLI based clone of that app).
I will publish the results of this âmanual diffâ here to save other folks the trouble of doing pedestrian tasks.
Problem solved - thanks to the work on skeleton-typescript-webpack which is BS4 based. I summarized the steps needed to make the CLI generated webpack skeleton navigation clone in this document and the finished NS-CLI-TS-webpack is here.
Note: this sample application (and many more to follow) is a part of the FrontEnd Creator application environment.