We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可参考https://www.webpackjs.com/guides/typescript/或https://webpack.js.org/guides/typescript/
npm install --save-dev typescript ts-loader
tsconfig.json
{ "compilerOptions": { "outDir": "./dist/", "noImplicitAny": true, "module": "es6", "target": "es5", "jsx": "react", "allowJs": true } }
webpack.config.js
const path = require("path"); module.exports = { entry: "./src/index.ts", module: { rules: [ { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/ } ] }, resolve: { extensions: [".tsx", ".ts", ".js"] }, output: { filename: "bundle.js", path: path.resolve(__dirname, "dist") } };
当从 npm 安装第三方库时,一定要牢记同时安装这个库的类型声明文件。可以从 TypeSearch 中找到并安装这些第三方库的类型声明文件。如:
npm install --save-dev @types/lodash
The text was updated successfully, but these errors were encountered:
No branches or pull requests
tsconfig.json
配置文件tsconfig.json
webpack.config.js
当从 npm 安装第三方库时,一定要牢记同时安装这个库的类型声明文件。可以从 TypeSearch 中找到并安装这些第三方库的类型声明文件。如:
The text was updated successfully, but these errors were encountered: