[英]webpack doesn't see files
tsconfig:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"declaration": true
},
"files": [
"sample2-inject/app.ts"
],
"exclude": [
]
}
webpack.config.js:
var path = require('path');
module.exports = {
entry: path.resolve("./sample2-inject/app.ts"),
output: {
path: path.resolve("./dist"),
filename: "bundle.js",
library: "home"
},
resolve: {
extensions: [".webpack.js", ".web.js", ".ts", ".js"]
},
module: {
loaders: [
{loader: "ts-loader"}
]
},
watch: true,
devtool: "eval"
};
应用程式:
import "es6-shim";
import "reflect-metadata";
import {Container} from "typedi";
错误:
[0] ./~/typedi/index.js 528字节{0} [构建] [失败] [1错误] [1] ./~/es6-shim/es6-shim.js 533字节{0} [构建] [失败] [1错误] [2] ./~/reflect-metadata/Reflect.js 540字节{0} [构建] [失败] [1错误]
./~/reflect-metadata/Reflect.js中的错误模块构建失败:错误:找不到文件:'/home/sesmanovich/www/JQueryPlugins/node_modules/reflect-metadata/Reflect.js'。 在getValidSourceFile(/usr/local/lib/node_modules/typescript/lib/typescript.js:81080:23)在Object.getEmitOutput(/usr/local/lib/node_modules/typescript/lib/typescript.js:81446:30)在Object.loader(/ home / sesmanovich / www / JQueryPlugins / node_modules / ts-loader / dist / index.js:27:11)@ ./sample2-inject/app.ts 4:0-27
从您的webpack配置中:
loaders: [
{loader: "ts-loader"}
]
是错的。 您仅应将ts-loader
用于ts/tsx
文件。
loaders: [ // loaders will work with webpack 1 or 2; but will be renamed "rules" in future
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.tsx?$/, loader: 'ts-loader' }
]
参见自述文件: https: //github.com/TypeStrong/ts-loader#configuration🌹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.