Skip to content
New issue

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

当我使用nuxt3 来使用ali-oss 的上传功能,在build的时候发生这个问题 #1241

Open
lmq352489099 opened this issue Aug 29, 2023 · 3 comments

Comments

@lmq352489099
Copy link

`ℹ ✓ 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那边配置的问题

@tgx1587900660
Copy link

tgx1587900660 commented Jan 2, 2024

我也遇到了这个问题,怎么解决?

@yxw007
Copy link

yxw007 commented Jul 10, 2024

`ℹ ✓ 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那边配置的问题

阿里云sdk的问题

@yxw007
Copy link

yxw007 commented Jul 10, 2024

我也遇到了这个问题,怎么解决?

在我的PR未合并发版之前,临时解决办法:node_modules/ali-oss/lib 下面的ts文件全部删除,重新打包应该就可以了
window 环境执行以下命令

find ./lib -name "*.ts" -type f -delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants