inputlogic / pwa-starter

A starting point for Preact based PWAs (WIP)
MIT License
3 stars 0 forks source link

replace babel-minify with terser #70

Closed staydecent closed 4 years ago

staydecent commented 4 years ago

babel minify is deprecated

staydecent commented 4 years ago
import { terser } from 'rollup-plugin-terser'

import baseConfig from './base'

const prodConfig = Object.assign({}, baseConfig)

prodConfig.output = prodConfig.output.map(cfg => ({
  ...cfg,
  sourcemap: false
}))

prodConfig.plugins.push(terser({
  keep_fnames: true,
  keep_classnames: true,
  output: {
    comments: (node, comment) => {
      const text = comment.value
      const type = comment.type
      if (type === 'comment2') {
        // multiline comment
        return /@preserve|@license|@cc_on/i.test(text)
      }
    }
  }
}))

export default prodConfig