Sha256: d137a3ee4796d62f1db6e50162efae4e90e7a38950d8c29476fd583f7d74f8b7

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

require "webpacker/configuration"

say "Copying erb loader to config/webpack/loaders"
copy_file "#{__dir__}/loaders/erb.js", Jets.root.join("config/webpack/loaders/erb.js").to_s

say "Adding erb loader to config/webpack/environment.js"
insert_into_file Jets.root.join("config/webpack/environment.js").to_s,
  "const erb =  require('./loaders/erb')\n",
  after: "require('@rails/webpacker')\n"

insert_into_file Jets.root.join("config/webpack/environment.js").to_s,
  "environment.loaders.append('erb', erb)\n",
  before: "module.exports"

say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
copy_file "#{__dir__}/examples/erb/hello_erb.js.erb",
  "#{Webpacker.config.source_entry_path}/hello_erb.js.erb"

say "Installing all Erb dependencies"
run "yarn add rails-erb-loader"

say "Webpacker now supports Erb in JS 🎉", :green

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webpacker-jets-3.2.101 lib/install/erb.rb
webpacker-jets-3.2.100 lib/install/erb.rb