[英]Solve or get rid of pattern matching error in tsconfig.json
How can I solve / get rid of a pattern matching error shown in Visual Studio Code?如何解决/消除 Visual Studio Code 中显示的模式匹配错误?
In my TypeScript application I get an error in the tsconfig.json
file, mentioning to not find an index.ts due to the matching of a certain pattern **/*
.在我的 TypeScript 应用程序中,我在
tsconfig.json
文件中遇到错误,提到由于匹配特定模式**/*
而找不到 index.ts。 The application still compiles and runs without any issues.该应用程序仍然可以编译和运行,没有任何问题。 The error only shows in Visual Studio Code.
该错误仅显示在 Visual Studio Code 中。 To compile the application I use Webpack, where I have defined and
index.tsx
file as the entry point, and not an index.ts
file.为了编译我使用 Webpack 的应用程序,我在其中定义了
index.tsx
文件作为入口点,而不是index.ts
文件。
webpack.config.js: webpack.config.js:
const path = require('path');
module.exports = {
entry: './src/main/ts/index.tsx',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
path: __dirname,
filename: './src/main/resources/static/built/bundle.js'
},
};
package.json dependencies: package.json 依赖项:
"dependencies": {
"@types/lodash": "^4.14.182",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rest": "^1.3.1",
"sockjs-client": "^1.0.3",
"stompjs": "^2.3.3"
},
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.2",
"ts-loader": "^9.3.0",
"typescript": "^4.7.4",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
Add添加
"include": ["src/**/*"],
To your tsconfig.json
到你的
tsconfig.json
It may help.它可能会有所帮助。 If not you have to reopen vscode it will fix this, but it's a little bit annoying
如果不是你必须重新打开 vscode 它会解决这个问题,但这有点烦人
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.