Skip to content

Instantly share code, notes, and snippets.

View fluidsonic's full-sized avatar

Marc Knaup fluidsonic

View GitHub Profile
import java.time.*
import kotlin.time.*
import kotlin.time.Duration
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
private object Done
private object TimerExpired
;+function () {
// noinspection JSUnresolvedFunction,NpmUsedModulesInstalled
const TerserPlugin = require('terser-webpack-plugin')
// noinspection JSUnresolvedVariable
if (config.mode === 'production') {
// noinspection JSUnresolvedVariable,SpellCheckingInspection,JSUnusedGlobalSymbols
config.optimization = {
minimize: true,
minimizer: [
@fluidsonic
fluidsonic / webpack.js
Created February 10, 2021 12:05
Kotlin/JS TeserPlugin settings for optimization
// …
new TerserPlugin({
terserOptions: {
// ecma: "2016", // doesn't work with some libraries
compress: {
keep_fargs: false,
negate_iife: false,
passes: 5, // 4 was highest number observed to date that results in even smaller code
pure_funcs(node) {
// noinspection JSUnresolvedVariable
import java.util.concurrent.*
import kotlin.reflect.*
import kotlinx.coroutines.*
class SynchronousEventEmitter(
private val onError: (error: Throwable, event: Event) -> Unit,
) : EventEmitter, EventSource {
private val subscriptions = CopyOnWriteArraySet<Subscription<*>>()