Jackie Jackie - 24 days ago 9
TypeScript Question

How do I use rules in webpack

In this Angular starter project we see...

module: {
rules: [
...
]
}


so I try to follow suit and change

module: {
loaders:[
...
]
}


To the one above, however, now it fails to transpile Typescript using the ts-loader. If I change it back to loaders it works great.

https://webpack.js.org/configuration/module/

Answer

rules was added for webpack2 only. It depends what version of webpack you are using. The starter repo uses webpack2.

Comments