修复模版

This commit is contained in:
Wang Kejun 2023-10-26 20:51:53 +08:00
parent dd3b51647b
commit 62d79316cd
4 changed files with 114 additions and 79 deletions

View File

@ -81,7 +81,7 @@ module.exports = function (proxy, allowedHost) {
overlay: { overlay: {
errors: true, errors: true,
warnings: false, warnings: false,
// runtimeErrors: false, runtimeErrors: false,
}, },
}, },
devMiddleware: { devMiddleware: {

View File

@ -217,6 +217,7 @@ function tsConfigJsonContent() {
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true, "strict": true,
"importHelpers": true,
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -226,37 +227,37 @@ function tsConfigJsonContent() {
//"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ //"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram"
], ],
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": [ "include": [
"./**/*.js", "./src/**/*.js",
"./**/*.ts", "./src/**/*.ts",
"./**/*.tsx", "./src/**/*.tsx",
"./**/*.mp.ts", "./web/src/**/*.ts",
"./**/*.web.ts", "./web/src/**/*.tsx",
"./**/*.web.tsx", "./wechatMp/src/**/*.js",
"./**/*.pc.ts", "./wechatMp/src/**/*.ts",
"./**/*.pc.tsx" "./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.spec.ts", "**/*.spec.ts",
"test", "test",
"scripts", "scripts",
"lib" "lib"
] ]
}`; }`;
} }
exports.tsConfigJsonContent = tsConfigJsonContent; exports.tsConfigJsonContent = tsConfigJsonContent;
function tsConfigBuildJsonContent() { function tsConfigBuildJsonContent() {
return `{ return `{
"extends": "./tsconfig.build.paths.json", "extends": "./tsconfig.build.paths.json",
"compilerOptions": { "compilerOptions": {
"jsx": "react-jsx", "jsx": "react-jsx",
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "esnext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
@ -271,17 +272,17 @@ function tsConfigBuildJsonContent() {
], ],
"outDir": "lib", /* Redirect output structure to the directory. */ "outDir": "lib", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ // "types": [
"node", // "node",
"miniprogram-api-typings" // "wechat-miniprogram"
], // ],
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": [ "include": [
"src/**/*" "src/**/*"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.spec.ts", "**/*.spec.ts",
"test", "test",
"src/pages/**/*", "src/pages/**/*",
@ -356,17 +357,18 @@ function tsConfigPathsJsonContent() {
exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent; exports.tsConfigPathsJsonContent = tsConfigPathsJsonContent;
function tsConfigMpJsonContent() { function tsConfigMpJsonContent() {
return `{ return `{
"extends": "./tsconfig.paths.json", "extends": "./tsconfig.paths.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "ESNext",
"target": "es5", "target": "ESNext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"importHelpers": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"strict": true, "strict": true,
"downlevelIteration": true, "downlevelIteration": true,
"importHelpers": true,
"moduleResolution": "Node",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -376,17 +378,25 @@ function tsConfigMpJsonContent() {
// "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram"
], ],
"resolveJsonModule": true, "resolveJsonModule": true,
"jsx": "react" "jsx": "react"
}, },
"include": [ "include": [
"./**/*.ts", "./src/**/*.js",
"./**/*.mp.ts" "./src/**/*.ts",
"./wechatMp/src/**/*.js",
"./wechatMp/src/**/*.ts",
"./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"scripts",
"test",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.test.tsx",
"./web" "./web"
] ]
}`; }`;
@ -396,15 +406,15 @@ function tsConfigWebJsonContent() {
return `{ return `{
"extends": "./tsconfig.paths.json", "extends": "./tsconfig.paths.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "ESNext",
"target": "es5", "target": "ESNext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"importHelpers": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true,
"strict": true, "strict": true,
"moduleResolution": "Node",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -414,21 +424,28 @@ function tsConfigWebJsonContent() {
// "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram",
"react"
], ],
"resolveJsonModule": true, "resolveJsonModule": true,
"jsx": "react" "jsx": "react"
}, },
"include": [ "include": [
"./**/*.ts", "./src/**/*.js",
"./**/*.tsx", "./src/**/*.ts",
"./**/*.web.ts", "./src/**/*.tsx",
"./**/*.web.tsx", "./web/src/**/*.js",
"./**/*.pc.ts", "./web/src/**/*.ts",
"./**/*.pc.tsx" "./web/src/**/*.tsx",
"./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"scripts",
"test",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.test.tsx",
"./wechatMp" "./wechatMp"
] ]
}`; }`;

View File

@ -224,6 +224,7 @@ export function tsConfigJsonContent() {
"experimentalDecorators": true, "experimentalDecorators": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true, "strict": true,
"importHelpers": true,
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -233,37 +234,37 @@ export function tsConfigJsonContent() {
//"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ //"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram"
], ],
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": [ "include": [
"./**/*.js", "./src/**/*.js",
"./**/*.ts", "./src/**/*.ts",
"./**/*.tsx", "./src/**/*.tsx",
"./**/*.mp.ts", "./web/src/**/*.ts",
"./**/*.web.ts", "./web/src/**/*.tsx",
"./**/*.web.tsx", "./wechatMp/src/**/*.js",
"./**/*.pc.ts", "./wechatMp/src/**/*.ts",
"./**/*.pc.tsx" "./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.spec.ts", "**/*.spec.ts",
"test", "test",
"scripts", "scripts",
"lib" "lib"
] ]
}`; }`;
} }
export function tsConfigBuildJsonContent() { export function tsConfigBuildJsonContent() {
return `{ return `{
"extends": "./tsconfig.build.paths.json", "extends": "./tsconfig.build.paths.json",
"compilerOptions": { "compilerOptions": {
"jsx": "react-jsx", "jsx": "react-jsx",
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "esnext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
@ -278,17 +279,17 @@ export function tsConfigBuildJsonContent() {
], ],
"outDir": "lib", /* Redirect output structure to the directory. */ "outDir": "lib", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ // "types": [
"node", // "node",
"miniprogram-api-typings" // "wechat-miniprogram"
], // ],
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": [ "include": [
"src/**/*" "src/**/*"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.spec.ts", "**/*.spec.ts",
"test", "test",
"src/pages/**/*", "src/pages/**/*",
@ -363,17 +364,18 @@ export function tsConfigPathsJsonContent() {
export function tsConfigMpJsonContent() { export function tsConfigMpJsonContent() {
return `{ return `{
"extends": "./tsconfig.paths.json", "extends": "./tsconfig.paths.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "ESNext",
"target": "es5", "target": "ESNext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"importHelpers": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"strict": true, "strict": true,
"downlevelIteration": true, "downlevelIteration": true,
"importHelpers": true,
"moduleResolution": "Node",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -383,17 +385,25 @@ export function tsConfigMpJsonContent() {
// "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram"
], ],
"resolveJsonModule": true, "resolveJsonModule": true,
"jsx": "react" "jsx": "react"
}, },
"include": [ "include": [
"./**/*.ts", "./src/**/*.js",
"./**/*.mp.ts" "./src/**/*.ts",
"./wechatMp/src/**/*.js",
"./wechatMp/src/**/*.ts",
"./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"scripts",
"test",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.test.tsx",
"./web" "./web"
] ]
}`; }`;
@ -403,15 +413,15 @@ export function tsConfigWebJsonContent() {
return `{ return `{
"extends": "./tsconfig.paths.json", "extends": "./tsconfig.paths.json",
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "ESNext",
"target": "es5", "target": "ESNext",
"allowJs": true, "allowJs": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"importHelpers": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true,
"strict": true, "strict": true,
"moduleResolution": "Node",
"lib": [ "lib": [
"dom", "dom",
"dom.iterable", "dom.iterable",
@ -421,21 +431,28 @@ export function tsConfigWebJsonContent() {
// "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"types": [ "types": [
"node", "node",
"miniprogram-api-typings" "wechat-miniprogram",
"react"
], ],
"resolveJsonModule": true, "resolveJsonModule": true,
"jsx": "react" "jsx": "react"
}, },
"include": [ "include": [
"./**/*.ts", "./src/**/*.js",
"./**/*.tsx", "./src/**/*.ts",
"./**/*.web.ts", "./src/**/*.tsx",
"./**/*.web.tsx", "./web/src/**/*.js",
"./**/*.pc.ts", "./web/src/**/*.ts",
"./**/*.pc.tsx" "./web/src/**/*.tsx",
"./typings/*.d.ts"
], ],
"exclude": [ "exclude": [
"node_modules", "node_modules",
"scripts",
"test",
"**/*.spec.ts",
"**/*.test.ts",
"**/*.test.tsx",
"./wechatMp" "./wechatMp"
] ]
}`; }`;

View File

@ -1,3 +1,4 @@
import '@oak-frontend-base/utils/wx.polyfill';
Object.assign(global, { Object.assign(global, {
/** /**
* wx环境下的fetch使 * wx环境下的fetch使