Closed artwc closed 1 year ago
提供一个最小复现的仓库
错误 RollupError:意外的关键字“this”(请注意,您需要插件来导入非 JavaScript 的文件) 硝基 20:07:05
7:从'../utils/checkConfigValid'导入{checkConfigValid}; 8: 9: 导出函数 getReqUrl(this: any, params) { ^ 10: const ep: any = {}; 11: const isCname = this.options.cname;
错误意外的关键字“this”(请注意,您需要插件来导入非 JavaScript 的文件)20:07:05
出错时(/D:/Works/yefang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:2124:30) 在Module.error(/D:/Works/yefang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:13463: 16) 在Module.tryParse(/D:/Works/yefang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js: 14184:25) 在 Module.setSource (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry。 js:13786:39) 在 ModuleLoader.addModuleSource (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-条目.js:23782:20)
nuxt3项目构建不过。降级5.3.2
是nuxt3降级还是alioss降级
`ℹ ✓ built in 13.04s 17:34:27 ✔ Server built in 13060ms 17:34:27 ✔ Generated public .output/public nitro 17:34:27 ℹ Building Nitro Server (preset: node-server) nitro 17:34:27 (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/client/getReqUrl.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/createRequest.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/encoder.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/setSTSToken.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/isFunction.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/retry.ts. Consider restricting the plugin to particular files via options.include (esbuild plugin) [esbuild] (.nuxt/dist/server/_nuxt/writer-5235dab7.js:1563:10) This assignment will throw because "cur_notebook" is a constant (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/isBuffer.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/obj2xml.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/checkBucketName.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/deepCopy.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/setRegion.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/checkConfigValid.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/getBucketInventory.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/putBucketInventory.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/listBucketInventory.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/bucket/getBucketWorm.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/object/postAsyncFetch.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/object/getAsyncFetch.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/checkBucketTag.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/formatObjKey.ts. Consider restricting the plugin to particular files via options.include (inject plugin) rollup-plugin-inject: failed to parse F:/project-lmq/learn-self-study/bingo-book/j2-book/node_modules/ali-oss/lib/common/utils/policy2Str.ts. Consider restricting the plugin to particular files via options.include
ERROR RollupError: Unexpected keyword 'this' (Note that you need plugins to import files that are not JavaScript) nitro 17:35:31
7: import { checkConfigValid } from '../utils/checkConfigValid'; 8: 9: export function getReqUrl(this: any, params) { ^ 10: const ep: any = {}; 11: const isCname = this.options.cname;
ERROR Unexpected keyword 'this' (Note that you need plugins to import files that are not JavaScript)`
这个是ali-oss的问题 还是nuxt3那边配置的问题
ERROR RollupError: Unexpected keyword 'this' (Note that you need plugins to import files that are not JavaScript) nitro 20:07:05
7: import { checkConfigValid } from '../utils/checkConfigValid'; 8: 9: export function getReqUrl(this: any, params) { ^ 10: const ep: any = {}; 11: const isCname = this.options.cname;
ERROR Unexpected keyword 'this' (Note that you need plugins to import files that are not JavaScript) 20:07:05
at error (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:2124:30) at Module.error (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:13463:16) at Module.tryParse (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:14184:25) at Module.setSource (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:13786:39) at ModuleLoader.addModuleSource (/D:/Works/yexiang/fs-nuxt-taozi-h5/node_modules/.pnpm/rollup@3.23.0/node_modules/rollup/dist/es/shared/node-entry.js:23782:20)
nuxt3项目 build不过。 降级 5.3.2