Sha256: 87d593346c1e73f7b66b62b297410092cba771dd456fb00dd0d2d6f8ed5ad079

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

import resolve from '@rollup/plugin-node-resolve'
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 esConfig = {
  format: 'es',
  inlineDynamicImports: true
}

const umdConfig = {
  name: 'StimulusReflex',
  format: 'umd',
  exports: 'named',
  globals: {
    '@rails/actioncable': 'ActionCable',
    morphdom: 'morphdom',
    cable_ready: 'CableReady',
    '@hotwired/stimulus': 'Stimulus'
  }
}

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

const output = distFolders
  .map(distFolder => [
    {
      ...umdConfig,
      file: `${distFolder}/${baseName}.umd.js`,
      plugins: [pretty()]
    },
    {
      ...esConfig,
      file: `${distFolder}/${baseName}.js`,
      format: 'es',
      plugins: [pretty()]
    }
  ])
  .flat()

export default [
  {
    external: [
      'morphdom',
      '@hotwired/stimulus',
      'cable_ready',
      '@rails/actioncable'
    ],
    input: 'javascript/index.js',
    output,
    plugins: [resolve(), json()],
    watch: {
      include: 'javascript/**'
    }
  }
]

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stimulus_reflex-3.5.0.rc4 rollup.config.mjs
stimulus_reflex-3.5.0.rc3 rollup.config.mjs
stimulus_reflex-3.5.0.rc2 rollup.config.mjs
stimulus_reflex-3.5.0.rc1 rollup.config.mjs