I am attempting to integrate webpack into my typescript application. In order to learn webpack I attempted a minimal migration. So I cloned the Angular2 quickstart seed, added a webpack.config.js:
'use strict';
let path = require('path');
module.exports = {
entry: './app/main.ts',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
exclude: /node_modules/,
},
]
},
output: {
filename: '/bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
};
And attempted a build:
PS C:\Users\ltheisen\git\pastdev-test-webpack> .\node_modules\.bin\webpack --display-error-details
Hash: 954fdea72e6d10e35648
Version: webpack 1.14.0
Time: 31ms
ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' ./app/main.ts in C:\Users\ltheisen\git\pastdev-test-webpack
resolve file
C:\Users\ltheisen\git\pastdev-test-webpack\app\main.ts.tsx doesn't exist
C:\Users\ltheisen\git\pastdev-test-webpack\app\main.ts.ts doesn't exist
C:\Users\ltheisen\git\pastdev-test-webpack\app\main.ts.js doesn't exist
resolve directory
C:\Users\ltheisen\git\pastdev-test-webpack\app\main.ts\package.json doesn't exist (directory description file)
C:\Users\ltheisen\git\pastdev-test-webpack\app\main.ts is not a directory (directory default file)
From the --display-error-details output, I can see that it check the file with all 3 extensions from resolve.extensions, but not for the file itself. All of the examples I have found use the file with the extension for entry (webpack basic setup, typescript integrating with build tools, ...). If I remove the extension, the webpack build finds the entry file (though I seem to have other problems...).
Anyway, my question is this: am I doing something wrong? Missing something obvious? Or is the documentation wrong?
---- UPDATE ---- It appears it may be something wrong with the npmjs repository. Specifically, the webpack 2 documentation for installation says:
npm install webpack --save-dev
However, npmjs shows shows version 1.14.0 as the current version:
This seems odd because version 2.2.0 was released last week... But i guess the release hasn't yet propagated to npmjs? After updating to webpack 2, this seems to have resolved my problem...
