Skip to content

Commit da93aeb

Browse files
committed
Install Webpacker
1 parent e7e2678 commit da93aeb

File tree

18 files changed

+7007
-1
lines changed

18 files changed

+7007
-1
lines changed

.babelrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"presets": [
3+
["env", {
4+
"modules": false,
5+
"targets": {
6+
"browsers": "> 1%",
7+
"uglify": true
8+
},
9+
"useBuiltIns": true
10+
}]
11+
],
12+
13+
"plugins": [
14+
"syntax-dynamic-import",
15+
"transform-object-rest-spread",
16+
["transform-class-properties", { "spec": true }]
17+
]
18+
}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@
2929

3030
# Ignore master key for decrypting credentials and more.
3131
/config/master.key
32+
/public/packs
33+
/public/packs-test
34+
/node_modules
35+
yarn-debug.log*
36+
.yarn-integrity

.postcssrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
plugins:
2+
postcss-import: {}
3+
postcss-cssnext: {}

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ gem 'bootsnap', '>= 1.1.0', require: false
3838

3939
gem 'jquery-rails'
4040

41+
gem 'webpacker', '~> 3.5'
42+
4143
group :development, :test do
4244
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
4345
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]

Gemfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ GEM
113113
public_suffix (3.0.3)
114114
puma (3.12.0)
115115
rack (2.0.6)
116+
rack-proxy (0.6.5)
117+
rack
116118
rack-test (1.1.0)
117119
rack (>= 1.0, < 3)
118120
rails (5.2.2)
@@ -188,6 +190,10 @@ GEM
188190
activemodel (>= 5.0)
189191
bindex (>= 0.4.0)
190192
railties (>= 5.0)
193+
webpacker (3.5.5)
194+
activesupport (>= 4.2)
195+
rack-proxy (>= 0.6.1)
196+
railties (>= 4.2)
191197
websocket-driver (0.7.0)
192198
websocket-extensions (>= 0.1.0)
193199
websocket-extensions (0.1.3)
@@ -217,6 +223,7 @@ DEPENDENCIES
217223
tzinfo-data
218224
uglifier (>= 1.3.0)
219225
web-console (>= 3.3.0)
226+
webpacker (~> 3.5)
220227

221228
RUBY VERSION
222229
ruby 2.6.1p33
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* eslint no-console:0 */
2+
// This file is automatically compiled by Webpack, along with any other files
3+
// present in this directory. You're encouraged to place your actual application logic in
4+
// a relevant structure within app/javascript and only use these pack files to reference
5+
// that code so it'll be compiled.
6+
//
7+
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8+
// layout file, like app/views/layouts/application.html.erb
9+
10+
console.log('Hello World from Webpacker')

app/views/layouts/application.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
99
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
10+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
1011
</head>
1112

1213
<body>

bin/webpack

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
3+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4+
ENV["NODE_ENV"] ||= "development"
5+
6+
require "pathname"
7+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8+
Pathname.new(__FILE__).realpath)
9+
10+
require "rubygems"
11+
require "bundler/setup"
12+
13+
require "webpacker"
14+
require "webpacker/webpack_runner"
15+
Webpacker::WebpackRunner.run(ARGV)

bin/webpack-dev-server

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
3+
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4+
ENV["NODE_ENV"] ||= "development"
5+
6+
require "pathname"
7+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8+
Pathname.new(__FILE__).realpath)
9+
10+
require "rubygems"
11+
require "bundler/setup"
12+
13+
require "webpacker"
14+
require "webpacker/dev_server_runner"
15+
Webpacker::DevServerRunner.run(ARGV)

config/environments/development.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Rails.application.configure do
2+
# Verifies that versions and hashed value of the package contents in the project's package.json
3+
config.webpacker.check_yarn_integrity = true
24
# Settings specified here will take precedence over those in config/application.rb.
35

46
# In the development environment your application's code is reloaded on

0 commit comments

Comments
 (0)