screeps-typescript-starter icon indicating copy to clipboard operation
screeps-typescript-starter copied to clipboard

rollup-plugin-terser minifying

Open stygmate opened this issue 6 years ago • 2 comments
trafficstars

Hi,

Can anybody help me with adding terser to the rollup plugins for minifying ?

stygmate avatar Nov 11 '19 09:11 stygmate

It works for me pretty much out of the box on a quick test.

  1. Install the rollup plugin as a development dependency
npm install -D rollup-plugin-terser
  1. Import plugin in rollup.config.js
import { terser } from "rollup-plugin-terser";
  1. Add plugin between Typescript compilation and the Screeps (uploader) in the plugins array.
  plugins: [
    clear({ targets: ["dist"] }),
    resolve(),
    commonjs(),
    typescript({tsconfig: "./tsconfig.json"}),
    terser(),
    screeps({config: cfg, dryRun: cfg == null})
  ]

This should run the compiled bundle of Javascript through terser before uploading to Screeps. If you have more questions about terser options you're better off checking with the plugin author.

pyrodogg avatar Jan 19 '20 11:01 pyrodogg

It works for me pretty much out of the box on a quick test.

  1. Install the rollup plugin as a development dependency
npm install -D rollup-plugin-terser
  1. Import plugin in rollup.config.js
import { terser } from "rollup-plugin-terser";
  1. Add plugin between Typescript compilation and the Screeps (uploader) in the plugins array.
  plugins: [
    clear({ targets: ["dist"] }),
    resolve(),
    commonjs(),
    typescript({tsconfig: "./tsconfig.json"}),
    terser(),
    screeps({config: cfg, dryRun: cfg == null})
  ]

This should run the compiled bundle of Javascript through terser before uploading to Screeps. If you have more questions about terser options you're better off checking with the plugin author.

Can I use "cleanup" plugin with terser? I see a lots of people doing that. If yes, who shoud come first?

ttxs25830 avatar Jun 30 '22 07:06 ttxs25830