Topic: Webpack Import: Asp.net Core 2 Angular 5 w/ angular-bootstrap-md
Hi,
I am trying to understand why after multiple failed attempts, I am unable to import angular-bootstrap-md into the vendor.js.
Github link: https://github.com/MKendall4094/TestMakerFreeApp
download it, npm install
Afterwards, in the webpack.config.vendor.js add the to the nonTreeShakableModules 'angular-bootstrap-md'.
Run powershell in the root folder, run this command: node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js
ERROR in dll vendor
Module not found: Error: Can't resolve 'angular-bootstrap-md' in 'C:ProjectsTestMakerFreeTestMakerFreeWebApp'
@ dll vendor
I suspect the issue is that webpack is looking for a dist or src directory within the node_module folder itself and therefore is unable to import correctly.
Regards,
Mike
EDIT: #1
I have tested using the tsconfig.json located in the node_modules folder for angular-bootstrap-md.
Created the a outDir : "./dist"
Add reference to the dist in webpack:
const nonTreeShakableModules = [ 'chart.js', 'hammerjs', 'angular-bootstrap-md/dist', 'angular-bootstrap-md/scss/bootstrap/bootstrap.scss', 'angular-bootstrap-md/scss/mdb-free.scss', 'font-awesome/scss/font-awesome.scss', 'es6-promise', 'es6-shim', 'event-source-polyfill', 'jquery' ];
Receive Errors:
ERROR in ./node_modules/angular-bootstrap-md/dist/index.js
Module not found: Error: Can't resolve './buttons' in 'C:\GitHubProjects\TestMakerFreeApp\TestMakerFreeWebApp\node_m
odules\angular-bootstrap-md\dist'
@ ./node_modules/angular-bootstrap-md/dist/index.js 9:0-42
@ dll vendor
Any thoughts?
EDIT #2
Bueller
Damian Gemza staff answered 7 years ago
mek4094 pro commented 7 years ago
Damian, I use Visual Studio as my primary development IDE. Through the New Project Wizard: - I created a New ASP.Net Core Web Application -> - After selecting a destination for the solution to be kept at the bottom -> - You are presented with a pre-built template for Angular -> - Once the app loads, npm install/update or let visual studio resolve the pending npm dependency downloads. (note* the project template right now in the .net core sdk has angular 4 pre-built into it) - If you grab the package json from my github, it will give you a start to copying over the new packages to update to Angular 5 and Bootstrap 4 if desired. - After that was complete you need to do some readjustments in some of the files, to handle AOT - After that then I proceeded to update the webpack vendor js configuration to allow for scss compilation and the ability to bring in angular-bootstrap-md It is at this point is where things started to become an issue, referencing angular-bootstrap-md from the npm packages had become a problem. (scss was fine on import however, the js (index.ts)) was not importing correctly. I will take a look at your solution and see if there is a working solution. Let me know if you have any questions! I am currently working through a development book: ISBN: 978-1-78829-360-0 Title: ASP.Net Core 2 and Angular 5 (Full stack web development with .Net Core and Angular) Nov. 2017 https://www.amazon.com/ASP-NET-Core-Angular-Full-Stack-Development/dp/1788293606/ref=sr_1_1_sspa?ie=UTF8&qid=1518101656&sr=8-1-spons&keywords=.net+core+2+with+angular&psc=1 Regards, MikeDamian Gemza staff answered 7 years ago
Hello again, Mike
Unfortunately, we won't be helpful in that case, since we have no experience in combining Angular with ASP in that way. However, we recently we have released our tested and verified guide how to combine MDB with ASP. Please check following link: https://mdbootstrap.com/angular/5min-quickstart (switch tab to .Net Core Free).
We will add your case to our suggestion list and have look in a future on alternative ways of installation.
Best Regards,
Damian
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No