[英]Webpack: ERROR in ./src/index.tsx Module not found: Error: Can't resolve './App' in '…'
I have the following error when trying to serve my app using webpack-dev-server: 尝试使用webpack-dev-server服务我的应用程序时出现以下错误:
ERROR in ./src/index.tsx
Module not found: Error: Can't resolve './App' in
'C:\Users\user\Desktop\react-resources-boilerplate\src'
@ ./src/index.tsx 15:28-44
@ multi (webpack)-dev-server/client?http://localhost:8080 ./src/index.tsx
Here is my webpack config file: 这是我的webpack配置文件:
const HtmlWebPackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src', 'index.tsx'),
module: {
rules: [
{
test: /\.ts|\.tsx$/,
loader: "ts-loader",
},
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
})
]
};
Here is my tsconfig file: 这是我的tsconfig文件:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"jsx": "react",
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true
}
}
Here is my index.tsx file: 这是我的index.tsx文件:
import * as React from 'react';
import { render } from 'react-dom';
import App from './App';
const root = document.querySelector('#root')
render(<App />, root)
Help appreciated Thanks 帮助赞赏谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.