father icon indicating copy to clipboard operation
father copied to clipboard

打包的时候能去掉console.log和comments吗?

Open LuoJimmy opened this issue 3 years ago • 2 comments

LuoJimmy avatar Jul 30 '22 13:07 LuoJimmy

.fatherrc.js

import terser from 'rollup-plugin-terser';

export default {
  esm: 'rollup',
  extraRollupPlugins: [
    terser({
      compress: {
        pure_funcs: ['console.log'], // 去除console.log
        drop_debugger: true, // 去掉debugger
        output: { comments: true }, // 去除注释
      },
    }),
  ],
};

"rollup-plugin-terser": "^7.0.2" [email protected]

未生效

LuoJimmy avatar Jul 30 '22 13:07 LuoJimmy

.fatherrc.js

import terser from 'rollup-plugin-terser';

export default {
  esm: 'rollup',
  extraRollupPlugins: [
    terser({
      compress: {
        pure_funcs: ['console.log'], // 去除console.log
        drop_debugger: true, // 去掉debugger
        output: { comments: true }, // 去除注释
      },
    }),
  ],
};

"rollup-plugin-terser": "^7.0.2" [email protected]

未生效

搞错了,不是这个库,是https://github.com/umijs/father-next

LuoJimmy avatar Aug 09 '22 02:08 LuoJimmy

I got the same question, anyone to help to fix this problem? thks very much

geekftz avatar Aug 31 '22 07:08 geekftz

Duplicate of #503

PeachScript avatar Aug 31 '22 10:08 PeachScript

你用的 father 4 但配置还是 father 2 的,需要参考 father 4 的文档更新

PeachScript avatar Aug 31 '22 10:08 PeachScript