These are chat archives for AngularClass/angular2-webpack-starter

17th
Mar 2016
Stanislav Kiryukhin
@KorsaR-ZN
Mar 17 2016 12:23
Hi, please tell me how to include the CSS file from the node_modules
Sam Jones
@ollwenjones
Mar 17 2016 13:43
@meiblorn in another library, we keep bumping into the 'No Directive annotation found' error, and it's almost always an angular version conflict between the project and a dependency. See schippie's explanation https://github.com/justindujardin/ng2-material/issues/38#issuecomment-195772602
looks like someone answered the SO question correctly though.
Aleš
@fxck
Mar 17 2016 14:03
anyone used lodash along webpack?
Sam Jones
@ollwenjones
Mar 17 2016 14:09
yes

I have in vendor.js

import 'lodash';

in my service:

import * as _ from 'lodash';
not confident the former is necessary to make it work, but it should ensure that lodash gets bundled in vendor.js instead of main.js
also had to install typings for it
Sam Jones
@ollwenjones
Mar 17 2016 14:18
in typings.json ambientDependencies
"lodash": "github:DefinitelyTyped/DefinitelyTyped/lodash/lodash.d.ts"
Aleš
@fxck
Mar 17 2016 14:24
ok @ollwenjones and what if you wanted to import only one function, say lodash/merge

import ‘lodash'; does not complain, and _.merge is there

import ‘lodash/merge'; does not complain, but _.merge is not there

import merge from ‘lodash/merge'; complains that Cannot find module 'lodash/merge’, same with import { merge } or import * as merge

Sam Jones
@ollwenjones
Mar 17 2016 14:27
ah, that is trickier... I'm not pro at TypeScript imports... I wonder if there are some examples in this starter for RxJS though... just a sec.
Aleš
@fxck
Mar 17 2016 14:27
here it works https://github.com/reactjs/redux/blob/master/examples/real-world/reducers/index.js#L2 but they are using babel, not typescript
Sam Jones
@ollwenjones
Mar 17 2016 14:29
seems like the version of lodash they are importing would have to have some exported member 'merge' at that location.
sorry once again I know just enough to be not very helpful
I would have guessed import * as merge from 'lodash/merge' would have worked... except you don't want a bare object merge you want _.merge
is lodash/merge the actual location in node_modules? doesn't seem to be in my case
yes it is, nevermind
Sam Jones
@ollwenjones
Mar 17 2016 14:35
and it even has module.exports = merge;
Aleš
@fxck
Mar 17 2016 14:40
yea
it should work
Sam Jones
@ollwenjones
Mar 17 2016 15:07
I wonder if it's a bug in the ts-loader?
mine Cannot find module 'lodash/merge'.
Sam Jones
@ollwenjones
Mar 17 2016 15:13
@fxck maybe not ideal, but as a workaround an old fashioned webpack require call works:
var merge = <any>require('lodash/merge');
Ross Patterson
@rpatterson
Mar 17 2016 19:35
How can I get npm run test to fail (exit code >0) if test coverage is too low?