-
Notifications
You must be signed in to change notification settings - Fork 756
Support singleton webpacker (3 and above) #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
392ec00
4531b1c
14865d8
80c03d8
8c7dcd8
cd74273
2b7cf68
d1e665e
ea8810e
5a78e5d
b960b9a
cc8528f
54f95b7
ed8a891
488a840
2c8ec5e
29c1d02
ca48da9
41b633f
a5f3da5
9b7af66
2492053
f33976a
1b210b0
72285ce
8c88a3b
4fad8b3
c587945
b6dc2aa
7b1b5ad
6324185
77536cd
253ccde
2805d9d
9390b09
4aa297f
f15b255
c61f74d
0c0b9bc
e3efcb8
0f75fe7
07afcb7
384a406
579367f
940f5dd
9437671
caf0827
f2330d9
e5bbe14
83fbdaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# This file was generated by Appraisal | ||
# This shouldn't have turbolinks or sprockets | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "turbolinks" | ||
gem "rails", "~> 5.0.0" | ||
|
||
gemspec :path => "../" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# This file was generated by Appraisal | ||
# This file shouldn't have turbolinks or sprockets in it | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "turbolinks" | ||
gem "rails", "~> 5.0.0" | ||
gem "webpacker", :github => "rails/webpacker" | ||
gem "webpacker", "~> 1.0" | ||
gem "therubyracer" | ||
|
||
gemspec :path => "../" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "turbolinks" | ||
gem "rails", "~> 5.0.0" | ||
gem "webpacker", ">= 3.0 " | ||
gem "therubyracer" | ||
|
||
gemspec :path => "../" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,8 @@ def webpacker? | |
|
||
def javascript_dir | ||
if webpacker? | ||
Webpacker::Configuration.source_path | ||
.join(Webpacker::Configuration.entry_path) | ||
webpack_configuration.source_path | ||
.join(webpack_configuration.entry_path) | ||
.relative_path_from(::Rails.root) | ||
.to_s | ||
else | ||
|
@@ -110,6 +110,12 @@ def setup_react_webpacker | |
create_file(manifest, WEBPACKER_SETUP_UJS) | ||
end | ||
end | ||
|
||
private | ||
|
||
def webpack_configuration | ||
Webpacker.respond_to?(:config) ? Webpacker.config : webpack_configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be Webpacker.respond_to?(:config) ? Webpacker.config : Webpacker::Configuration There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aaw whoops. Wondered why my test didn't pass XD Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've still got issues around |
||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Note: You must restart bin/webpack-dev-server for changes to take effect | ||
|
||
default: &default | ||
source_path: app/javascript | ||
source_entry_path: packs | ||
public_output_path: packs | ||
cache_path: tmp/cache/webpacker | ||
|
||
# Additional paths webpack should lookup modules | ||
# ['app/assets', 'engine/foo/app/assets'] | ||
resolved_paths: [] | ||
|
||
# Reload manifest.json on all requests so we reload latest compiled packs | ||
cache_manifest: false | ||
|
||
extensions: | ||
- .coffee | ||
- .erb | ||
- .js | ||
- .jsx | ||
- .ts | ||
- .vue | ||
- .sass | ||
- .scss | ||
- .css | ||
- .png | ||
- .svg | ||
- .gif | ||
- .jpeg | ||
- .jpg | ||
|
||
development: | ||
<<: *default | ||
compile: true | ||
|
||
dev_server: | ||
host: localhost | ||
port: 3035 | ||
hmr: false | ||
https: false | ||
|
||
test: | ||
<<: *default | ||
compile: true | ||
|
||
# Compile test packs to a separate directory | ||
public_output_path: packs-test | ||
|
||
production: | ||
<<: *default | ||
|
||
# Production demands on precompilation of packs prior to booting for performance. | ||
compile: false | ||
|
||
# Cache manifest.json for performance | ||
cache_manifest: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new singleton implementation of
Webpacker::Configuration
no longer hasentry_path
. Instead,Webpacker::Configuration.source_path.join(Webpacker::Configuration.entry_path)
becomesWebpacker.config.source_entry_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have suggested these changes in issue #778 .Please have a look into it. I was trying to install react with rails and failed to run react installer command. I look into gem and found that method calling is not proper.
I fix this with minor changes in
lib/generators/react/install_generator.rb
file.source_path
is a instance method and was being called by class directly. Alsoentry_path
was changed tosource_entry_path
in webpacker config. I have suggested these changes in #778The main purpose for issue was #778 was to elevate exact issue and its solution along with it, as there was no fix until that time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using webpacker 3.0.1 Webpacker.config.source_entry_path worked for me 👍