Sha256: f71c1e1e2bc7aee292305d370d1cb6580644ef1b70cbd44037103e19172fd665

Contents?: true

Size: 1.37 KB

Versions: 9

Compression:

Stored size: 1.37 KB

Contents

import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { terser } from 'rollup-plugin-terser'

const pretty = () => {
  return terser({
    mangle: false,
    compress: false,
    format: {
      beautify: true,
      indent_level: 2
    }
  })
}

const minify = () => {
  return terser({
    mangle: true,
    compress: true
  })
}

const esConfig = {
  format: 'es',
  inlineDynamicImports: true
}

const umdConfig = {
  name: 'Futurism',
  format: 'umd',
  exports: 'named',
  globals: {
    cable_ready: 'CableReady'
  }
}

const distFolders = ['dist/', 'app/assets/javascripts/']

const output = distFolders
  .map(distFolder => [
    {
      ...esConfig,
      file: `${distFolder}/futurism.js`,
      plugins: [pretty()]
    },
    {
      ...esConfig,
      file: `${distFolder}/futurism.min.js`,
      sourcemap: true,
      plugins: [minify()]
    },
    {
      ...umdConfig,
      file: `${distFolder}/futurism.umd.js`,
      plugins: [pretty()]
    },
    {
      ...umdConfig,
      file: `${distFolder}/futurism.umd.min.js`,
      sourcemap: true,
      plugins: [minify()]
    }
  ])
  .flat()

export default [
  {
    external: ['cable_ready'],
    input: 'javascript/index.js',
    output,
    plugins: [commonjs(), resolve(), json()],
    watch: {
      include: 'javascript/**'
    }
  }
]

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
futurism-1.4.2 rollup.config.js
futurism-1.4.1 rollup.config.js
futurism-1.4.0 rollup.config.js
futurism-1.3.0 rollup.config.js
futurism-1.2.0 rollup.config.js
futurism-1.2.0.rc2 rollup.config.js
futurism-1.2.0.rc1 rollup.config.js
futurism-1.2.0.pre11 rollup.config.js
futurism-1.2.0.pre10 rollup.config.js