I have the following Webpack and TypeScript configs:
webpack.config.js
module.exports = {
entry: {
dev: './src/ts/site'
},
output: {
filename: './com/js/site.js'
},
resolve: {
extensions: ['', '.ts', '.tsx']
},
module: {
loaders: [
// Typescript
{
test: /\.tsx?$/,
loader: 'ts-loader'
}
]
}
}
tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"module": "commonjs"
}
}
I've simplified my project to only include the following dependencies:
package.json (partial)
"typescript": "^1.7.5",
"ts-loader": "^0.7.2",
"webpack": "^1.12.9"
When I run Webpack, I get a massive slew of errors:
The list goes on for many many screen lengths, but as far as I've scrolled every one is a duplicate identifier error in a .d.ts
file.
What is the cause of these errors?
I've seen several similar problems both here on Stack, and across the web, but none seemed to happen in a project with just TypeScript (they all had other modules that had definition files).
From what I've gathered it may have something to do with my use of "module": "commonJS"
, but
- That would suggest that TypeScript wasn't written to work with commonJS modules
- I've already tried every other module type with no success
Excluding node_modules
in tsconfig.json
solves the problem but makes it so that installed modules can't be found in .ts files.