美文网首页
rollup 错误+警告集锦

rollup 错误+警告集锦

作者: 猿话 | 来源:发表于2020-10-20 18:03 被阅读0次
5、(plugin uglify) Error: Unexpected token: name «key», expected: punc «;»
[!] (plugin uglify) Error: Unexpected token: name «key», expected: punc «;»
SyntaxError: Unexpected token: name «key», expected: punc «;»
    at JS_Parse_Error.get (eval at <anonymous> (/Users/~/Documents/fe-module/demo/node_modules/rollup-plugin-uglify/node_modules/uglify-js/tools/node.js:18:1), <anonymous>:71:23)
    at reportError (/Users/~/Documents/fe-module/demo/node_modules/jest-worker/build/workers/processChild.js:107:11)
    at reportClientError (/Users/~/Documents/fe-module/demo/node_modules/jest-worker/build/workers/processChild.js:87:10)
  • 原因:
    1、uglify-js 只支持压缩es5,不支持es6压缩。
    2、原文描述: *Note: uglify-js is able to transpile only es5 syntax. If you want to transpile es6+ syntax use [terser](https://github.com/TrySound/rollup-plugin-terser) instead*
  • 解决方案:
    1、先用@rollup/plugin-babel 将es6转为es5再压缩。
    2、使用rollup-plugin-terser压缩。
4、core-js/modules/es6.regexp.match (imported by src/test/base.js)
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
core-js/modules/es6.regexp.match (imported by src/test/base.js)
core-js/modules/es6.array.index-of (imported by src/test/base.js)
core-js/modules/es6.regexp.to-string (imported by src/test/util.js)
core-js/modules/es6.date.to-string (imported by src/test/util.js)
core-js/modules/es6.object.to-string (imported by src/test/util.js)
core-js/modules/es6.regexp.split (imported by src/test/android.js,
3、Plugin node-resolve: preferring built-in module 'process' over local alternative .....
(!) Plugin node-resolve: preferring built-in module 'process' over local alternative at '/Users/~/Documents/fe-module/demo/node_modules/process/index.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
(!) Plugin node-resolve: preferring built-in module 'util' over local alternative at '/Users/~/Documents/fe-module/demo/node_modules/util/util.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
(!) Plugin node-resolve: preferring built-in module 'buffer' over local alternative at '/Users/~/Documents/fe-module/demo/node_modules/buffer/index.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
  • 原因:@rollup/plugin-node-resolve 给出警告,如果为true,则插件将首先查找内置模块(例如fs、path)。如果为false,则插件将查找本地安装的同名模块。
  • 解决方案: 建议显示的书写下,preferBuiltins: true
2、 /Users/~/Documents/fe-module/demo/node_modules/rollup/dist/shared/loadConfigFile.js:478
> @sdk@1.0.0 rollup /Users/~/Documents/fe-module/demo
> rollup --config build/rollup/rollup.config.js

/Users/~/Documents/fe-module/demo/node_modules/rollup/dist/shared/loadConfigFile.js:478
        ? (await import(url.pathToFileURL(fileName).href)).default
                 ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:605:28)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/~/Documents/fe-module/demo/node_modules/rollup/dist/bin/rollup:22:25)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sdk@1.0.0 rollup: `rollup --config build/rollup/rollup.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @sdk@1.0.0 rollup script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/~/.npm/_logs/2020-10-20T09_41_23_702Z-debug.log
  • 原因: 从v2.0.0+ 开始不再支持node 8。
  • 解决方案:升级更高版本的 node
1、You have passed an unrecognized option
(!) You have passed an unrecognized option
Unknown input options: globals. Allowed options: acorn, acornInjectPlugins, cache, context, experimentalCacheExpiry, external, inlineDynamicImports, input, manualChunks, moduleContext, onwarn, perf, plugins, preserveEntrySignatures, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch
  • 原因: 该层级非法的配置项。
  • 解决方案:globals属性存在output配置中。

参考文献
1、https://github.com/rollup/rollup/pull/3472

相关文章

  • rollup 错误+警告集锦

    5、(plugin uglify) Error: Unexpected token: name «key», ex...

  • Xcode 错误、报错、警告集锦

    以前遇到的各种Xcode报错!都放进来了!以后还有会继续加入!相当于一个记错本! [ A ]. 本地化字符串文件不...

  • vue项目源码-rollup-plugin-alias插件问题解

    在我用windows系统运行vue项目dev分支时,报了以下错误: [!] (plugin Rollup Core...

  • 关于Swift

    错误集锦1,Call can throw, but it is not marked with 'try' and...

  • nginx 错误集锦

    Nginx错误集锦主要收集在学习使用Nginx过程中出现的各类错误及相应的解决方案,本集锦将持续更新,仅供参考。 ...

  • 错误集锦

    一、Xcode摘自:http://tips.tutorialhorizon.com/2015/10/01/xcru...

  • 错误集锦

    Manifest merger failed with multiple errors, see ?Error:E...

  • 错误集锦

    开发Call:不要直接约 Demo:不要每页PPT都讲 层层铺垫

  • 错误集锦

    1. 视图层级错误 比如UIButton被后面加上去的view挡住了 2. Autolayout 伸缩 UILab...

  • iOS中#pragma clang diagnostic的常见用

    将警告识别为错误   如果我们希望一个警告必须被修改掉,以保证程序的安全,我们可以将警告识别为错误,虽然xcode...

网友评论

      本文标题:rollup 错误+警告集锦

      本文链接:https://www.haomeiwen.com/subject/tundmktx.html