screeps-typescript-starter
screeps-typescript-starter copied to clipboard
rollup-plugin-terser minifying
Hi,
Can anybody help me with adding terser to the rollup plugins for minifying ?
It works for me pretty much out of the box on a quick test.
- Install the rollup plugin as a development dependency
npm install -D rollup-plugin-terser
- Import plugin in
rollup.config.js
import { terser } from "rollup-plugin-terser";
- 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.
It works for me pretty much out of the box on a quick test.
- Install the rollup plugin as a development dependency
npm install -D rollup-plugin-terser
- Import plugin in
rollup.config.jsimport { terser } from "rollup-plugin-terser";
- 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?