Check out this webpack configuration file:
module.exports = {
mode: "development",
entry: "./src/index.ts",
output: { filename: "bundle.js" },
resolve: { extensions: [".ts"] },
module: {
rules: [
{ test: /\.ts/, use: "ts-loader", exclude: /node_modules/ }
}
]
}
};
I'm puzzled by the need to exclude node_modules when dealing with TypeScript files. Here are my thoughts:
1. Most packages are written in JavaScript, not TypeScript, so including node_modules shouldn't cause any issues.
2. If we are using a TypeScript package and want it to compile to JavaScript, then including node_modules seems necessary for everything to work properly, don't you think?