"Unexpected token import" error with Angular4 + Universal + ng-bootstrap
For those trying to understand what the solution is, you basically want to use and whitelist angular2-toaster
and other modules giving this issue.
- if using angular-cli, use
ng eject
to create awebpack.config.js
install the
webpack-node-externals
dependency vianpm install
and add the following lines in thewebpack.config.js
fileconst nodeExternals = require('webpack-node-externals'); module.exports = { ... target: 'node', externals: [nodeExternals({ whitelist: [ /^@ng-bootstrap\/ng-bootstrap/, /^angular2\-toaster/, ] })], ... }