rollup-plugin-cleanup

rollup-plugin-cleanup是一个Rollup插件,用于清理、优化和压缩JavaScript代码。它可以控制注释的保留,压缩空格,限制连续空行,并处理不同扩展名的文件。此外,还能选择性地生成源映射。

`rollup-plugin-cleanup` 是一个用于清理、优化和压缩 JavaScript 代码的 Rollup 插件。以下是 `rollup-plugin-cleanup` 可用的参数:

#### `comments`

- 类型: `string | Regexp | ((node: Object, comment: Object) => boolean)`

- 默认值: `true`

用于设置是否移除特定类型的注释。可以使用字符串或正则表达式来指定需要移除的注释类型。

#### `compactComments`

- 类型: `boolean`

- 默认值: `false`

用于设置是否压缩注释。如果启用了此选项,则注释中的连续空格和换行符将被移除。

#### `maxEmptyLines`

- 类型: `number`

- 默认值: `1`

用于设置最多可以连续存在的空行数。如果存在大于此数量的连续空行,则将被缩减为此数量。

#### `extensions`

- 类型: `string[]`

- 默认值: `['.js']`

用于指定要处理的文件扩展名。例如,如果您需要处理 `.jsx` 文件,则可以将 `extensions` 设置为 `['.js', '.jsx']`。

#### `sourcemap`

- 类型: `boolean`

- 默认值: `false`

用于设置是否生成源映射文件。

以上是 `rollup-plugin-cleanup` 可用的参数。您可以根据需要自定义这些参数,并将其添加到 `rollup.config.js` 中来清理、优化和压缩您的 JavaScript 代码。

> hvigor ERROR: Failed :phone:default@CompileArkTS... > hvigor ERROR: Cannot read properties of undefined (reading 'sourceFile') COMPILE RESULT:FAIL {ERROR:1} * Try the following: > Check whether undefined attributes or methods are used in the hvigorconfig.ts and hvigorfile.ts files. > Go to the official website for help > More info: https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs-V5/faqs-compiling-and-building-108-V5 > hvigor ERROR: Error: Cannot read properties of undefined (reading 'sourceFile') COMPILE RESULT:FAIL {ERROR:1} at runArkPack (D:\DevEco Studio\tools\hvigor\hvigor-ohos-plugin\node_modules\@ohos\hvigor-arkts-compose\dist\src\arkts-pack.js:1:5438) TypeError: Cannot read properties of undefined (reading 'sourceFile') at isDocumentRegistryEntry (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:142826:24) at getDocumentRegistryEntry (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:142886:25) at Object.releaseDocumentWithKey (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:142992:25) at Object.onReleaseOldSourceFile (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:172736:34) at Object.createProgram (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:122284:26) at synchronizeHostData (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:172688:30) at Object.getProgram (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\node_modules\typescript\lib\typescript.js:172805:13) at resetEtsCheckTypeScript (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\lib\ets_checker.js:4:18897) at resetEtsCheck (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\lib\ets_checker.js:4:19149) at Object.cleanUp (D:\DevEco Studio\sdk\default\openharmony\ets\build-tools\ets-loader\lib\fast_build\ets_ui\rollup-plugin-ets-typescript.js:1:6817) > hvigor ERROR: BUILD FAILED in 7 s 543 ms
最新发布
09-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值