xiaomingTang / quick-scaffold

一个用于快速生成 web page, web package, node package 的脚手架
MIT License
14 stars 1 forks source link

build后报错 #3

Open Sun-Chenyang opened 2 years ago

Sun-Chenyang commented 2 years ago

创建tampermonkey,yarn start后正常运行demo,但yarn run build后报错如下

PS E:\codes\code> yarn run build yarn run v1.22.19 $ cross-env NODE_ENV=production TS_NODE_PROJECT="config/tsconfig-for-webpack-config.json" webpack --config config/webpack.prod.config.ts

E:\codes\code\node_modules\ts-node\src\index.ts:513 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: config/webpack.prod.config.ts:13:3 - error TS2322: Type '(Plugin | InjectStringWebpackPlugin)[]' is not assignable to type 'Plugin[]'. Type 'Plugin | InjectStringWebpackPlugin' is not assignable to type 'Plugin'. Type 'InjectStringWebpackPlugin' is not assignable to type 'Plugin'. Types of property 'apply' are incompatible. Type '(compiler: import("E:/codes/code/node_modules/inject-string-webpack-plugin/node_modules/webpack/types").Compiler) => void' is not assignable to type '(compiler: import("E:/codes/code/node_modules/@types/webpack/index").Compiler) => void'. Types of parameters 'compiler' and 'compiler' are incompatible. Type 'Compiler' is missing the following properties from type 'Compiler': webpack, root, watching, intermediateFileSystem, and 31 more.

13 plugins: [


  node_modules/@types/webpack/index.d.ts:144:9
    144         plugins?: Plugin[] | undefined;
The expected type comes from property 'plugins' which is declared here on type 'Configuration & { devServer?: Configuration; }'

at createTSError (E:\codes\code\node_modules\ts-node\src\index.ts:513:12)
at reportTSError (E:\codes\code\node_modules\ts-node\src\index.ts:517:19)
at getOutput (E:\codes\code\node_modules\ts-node\src\index.ts:752:36)
at Object.compile (E:\codes\code\node_modules\ts-node\src\index.ts:968:32)
at Module.m._compile (E:\codes\code\node_modules\ts-node\src\index.ts:1056:42)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (E:\codes\code\node_modules\ts-node\src\index.ts:1059:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (E:\codes\code\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (E:\codes\code\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
at requireConfig (E:\codes\code\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
at E:\codes\code\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (E:\codes\code\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
at E:\codes\code\node_modules\webpack-cli\bin\cli.js:71:45
at Object.parse (E:\codes\code\node_modules\yargs\yargs.js:576:18)
at E:\codes\code\node_modules\webpack-cli\bin\cli.js:49:8
at Object.<anonymous> (E:\codes\code\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (E:\codes\code\node_modules\webpack\bin\webpack.js:156:2)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

xiaomingTang commented 2 years ago

@171928131 开发油猴更建议使用 vite-plugin-monkey,使用体验远超本模板,vite 开发体验也远超 webpack

应该是 webpack 和插件版本冲突,由于 vite 异军突起,所以我可能不怎么会维护这个模板了,抱歉