Skip to content
  • Matias Grunberg's avatar
    2dbcb3df
    fix using actiontext.js in sprocket · 2dbcb3df
    Matias Grunberg authored
    actiontext.js is compiled as ESM bundle instead of UMD bundle.
    This leads to issues when trying to use ActionText with sprockets because the ESM bundle declares variables like they are scoped to the file but sprockets will see them as scoped globally.
    This is a problem, in particular, if you want to mix actiontext with
    turbo-rails.
    
    The problem got introduced in https://github.com/rails/rails/pull/46447.
    I traced valid compilation back to
    https://github.com/rails/rails/pull/42895.
    
    This commit mimic changes made in
    https://github.com/rails/rails/pull/42895 to ActiveStorage:
       Retains app/assets/javascripts/actiontext.js as a UMD package for backwards compatibility with
       bundling in the asset pipeline, but also adds app/assets/javascripts/actiontext.esm.js for use
       with ESM via importmap in the browser.
    2dbcb3df
    fix using actiontext.js in sprocket
    Matias Grunberg authored
    actiontext.js is compiled as ESM bundle instead of UMD bundle.
    This leads to issues when trying to use ActionText with sprockets because the ESM bundle declares variables like they are scoped to the file but sprockets will see them as scoped globally.
    This is a problem, in particular, if you want to mix actiontext with
    turbo-rails.
    
    The problem got introduced in https://github.com/rails/rails/pull/46447.
    I traced valid compilation back to
    https://github.com/rails/rails/pull/42895.
    
    This commit mimic changes made in
    https://github.com/rails/rails/pull/42895 to ActiveStorage:
       Retains app/assets/javascripts/actiontext.js as a UMD package for backwards compatibility with
       bundling in the asset pipeline, but also adds app/assets/javascripts/actiontext.esm.js for use
       with ESM via importmap in the browser.
Loading