Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular typescript的网页包找不到输入模块_Angular_Typescript_Webpack - Fatal编程技术网

Angular typescript的网页包找不到输入模块

Angular typescript的网页包找不到输入模块,angular,typescript,webpack,Angular,Typescript,Webpack,我正在尝试将webpack集成到我的typescript应用程序中。为了学习webpack,我尝试了一次最小的迁移。所以我克隆了Angular2,添加了webpack.config.js: 'use strict'; let path = require('path'); module.exports = { entry: './app/main.ts', module: { rules: [ { test

我正在尝试将webpack集成到我的typescript应用程序中。为了学习webpack,我尝试了一次最小的迁移。所以我克隆了Angular2,添加了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"]
    },
};
并尝试构建:

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)
--display error details
输出中,我可以看到它检查了
resolve.extensions
中所有3个扩展名的文件,但没有检查文件本身。我发现的所有示例都使用扩展名为
entry
(,…)的文件。如果我删除扩展名,webpack构建会找到
条目
文件(尽管我似乎还有其他问题…)

不管怎样,我的问题是:我做错什么了吗?遗漏了一些明显的东西?还是文档错误

----更新--- 看来npmjs存储库可能有问题。具体而言,报告说:

但是,npmjs显示版本1.14.0为当前版本:


这看起来很奇怪,因为2.2.0版上周发布了。。。但我猜这个版本还没有传播到NPMJ?更新到webpack 2后,这似乎解决了我的问题…

npm显示上次发布的版本,使用
npm查看webpack
查找所有版本。

webpack 2在此之前一直处于预发布阶段。如果2.2.0被认为不稳定,我无法解释为什么它没有相应地进行标记,但它是以这种方式发布的,
npm dist tag ls webpack
输出:

测试版:2.2.0

最新版本:1.14.0

使用适当的软件安装:

npm install webpack@2 --save-dev

谢谢你的信息。我刚决定切换到webpack,所以不知道它刚刚发布。刚才看到有一个版本2,文档中说只需使用
npm安装webpack
。我很自然地认为它将要安装版本2。。。从那以后我学得更好了。
npm install webpack@2 --save-dev