1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actioncable/rollup.config.js
David Heinemeier Hansson 4a23cb3415
Output Action Cable JS without transpiling and as ESM (#42856)
* Output Action Cable JS without transpiling and as ESM

* Retain umd version under the old name, generate ESM version + duplicate under new name

* Precompile JavaScripts for direct asset pipeline use

* We've dropped support for IE11

* Include deprecation notice for the old file reference

Thanks @rafaelfranca 👍

* Allow app to opt out of precompiling actioncable js assets

cc @rafaelfranca

* Add changelog entries
2021-08-06 14:00:43 +02:00

47 lines
No EOL
899 B
JavaScript

import resolve from "@rollup/plugin-node-resolve"
import { terser } from "rollup-plugin-terser"
const terserOptions = {
mangle: false,
compress: false,
format: {
beautify: true,
indent_level: 2
}
}
export default [
{
input: "app/javascript/action_cable/index.js",
output: [
{
file: "app/assets/javascripts/actioncable.js",
format: "umd",
name: "ActionCable"
},
{
file: "app/assets/javascripts/actioncable.esm.js",
format: "es"
}
],
plugins: [
resolve(),
terser(terserOptions)
]
},
{
input: "app/javascript/action_cable/index_with_name_deprecation.js",
output: {
file: "app/assets/javascripts/action_cable.js",
format: "umd",
name: "ActionCable"
},
breakOnWarning: false,
plugins: [
resolve(),
terser(terserOptions)
]
},
]