0

I've been looking for a solution to this without luck, no one seems to know how to properly import popper.js to the angular 5 project in .net core, I'm using visual studio 2017, this happened after updating the packages, I know this is something related to bootstrap 4, this is my package.json:

  {
  "name": "Monitor",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "devDependencies": {
    "@angular/animations": "^5.2.5",
    "@angular/common": "^5.2.5",
    "@angular/compiler": "^5.2.5",
    "@angular/compiler-cli": "^5.2.5",
    "@angular/core": "^5.2.5",
    "@angular/forms": "5.2.5",
    "@angular/http": "5.2.5",
    "@angular/platform-browser": "5.2.5",
    "@angular/platform-browser-dynamic": "5.2.5",
    "@angular/platform-server": "5.2.5",
    "@angular/router": "5.2.5",
    "@ngtools/webpack": "1.10.0",
    "@types/chai": "4.1.2",
    "@types/jasmine": "2.8.6",
    "@types/webpack-env": "1.13.5",
    "angular2-router-loader": "0.3.5",
    "angular2-template-loader": "0.6.2",
    "aspnet-prerendering": "^3.0.1",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "3.4.1",
    "bootstrap": "4.0.0",
    "chai": "4.1.2",
    "css": "2.2.1",
    "css-loader": "0.28.9",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.12",
    "expose-loader": "0.7.4",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.7",
    "html-loader": "0.5.5",
    "isomorphic-fetch": "2.2.1",
    "jasmine-core": "2.99.1",
    "jquery": "^3.3.1",
    "json-loader": "0.5.7",
    "karma": "2.0.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.1",
    "karma-webpack": "2.0.9",
    "preboot": "6.0.0-beta.2",
    "raw-loader": "0.5.1",
    "reflect-metadata": "^0.1.12",
    "rxjs": "5.5.6",
    "style-loader": "0.20.2",
    "to-string-loader": "1.1.5",
    "typescript": "2.7.2",
    "url-loader": "0.6.2",
    "webpack": "3.11.0",
    "webpack-hot-middleware": "2.21.0",
    "webpack-merge": "4.1.1",
    "zone.js": "0.8.20"
  },
  "dependencies": {
    "popper.js": "^1.12.9"
  }
}

Notice the popper.js dependency, so it is installed, should it go there or somewhere else?

Also tried: import 'popper.js' in boot.browser.ts file before the bootstrap import.

I don't know where to look, and no one seems to have the correct answer to this.

Thanks in advance.

EDIT: I followed this tutorial to create and update the angular app using VS2017 with .net core 2 https://www.codeproject.com/Articles/1221503/Angular-and-NET-Core-with-Visual-Studio

Efiloss
  • 21
  • 4

1 Answers1

0

Seems that I solved the problem, the webpack.config.vendor.js file had to be rebundled with popper.js in it:

const nonTreeShakableModules = [
    'bootstrap',
    'bootstrap/dist/css/bootstrap.css',
    'es6-promise',
    'es6-shim',
    'event-source-polyfill',
    'jquery',
];

and with popper.js:

const nonTreeShakableModules = [
    'popper.js/dist/umd/popper.js',
    'bootstrap',
    'bootstrap/dist/css/bootstrap.css',
    'es6-promise',
    'es6-shim',
    'event-source-polyfill',
    'jquery',
];

Also you'll need to close Visual Studio before you run this command from power-shell as administrator:

webpack --config webpack.config.vendor.js

and voila! It worked again.

Efiloss
  • 21
  • 4