I have some difficulties with webpack and typescript. There are many .ts files in different folders in my project. Earlier I didn't use module system like commonjs or AMD but typescript namespaces (module keyword) were used. The files were not concatenated into single one. It means that nearby each .ts file .js file were generated and then all the .js files were included in HTML.
Now I try to use webpack and ts-loader.
module.exports = {
context: __dirname,
entry: "app.ts",
output: {
path: __dirname,
filename: 'bundle.js'
},
resolve: {
root: __dirname,
extensions: ["", ".webpack.js", ".web.js", ".js",".ts", ".tsx"]
},
module: {
loaders: [
{
test: /\.tsx?$/,
loader: 'ts-loader'
}
]
}
}
After compile in the bundle.js file I can find only the app.ts compiled content, but not all the other files. As I understood it is because I didn't use the import keyword. Webpack ts-loader compile only those files that are modules. If I start typescript compiler it will compile all the files in my project as earlier.
The question is: how to add in bundle.js all the typescript files even if they are not i.e. commonjs modules? Thanks.