webpacker 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +14 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +124 -0
  5. data/.travis.yml +24 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +6 -6
  8. data/README.md +126 -19
  9. data/lib/install/angular.rb +18 -0
  10. data/lib/install/bin/webpack-dev-server.tt +23 -12
  11. data/lib/install/bin/webpack-watcher.tt +3 -0
  12. data/lib/install/bin/webpack.tt +33 -7
  13. data/lib/install/config/.postcssrc.yml +4 -0
  14. data/lib/install/config/loaders/core/assets.js +12 -0
  15. data/lib/install/config/loaders/core/babel.js +10 -0
  16. data/lib/install/config/loaders/core/coffee.js +4 -0
  17. data/lib/install/config/loaders/core/erb.js +9 -0
  18. data/lib/install/config/loaders/core/sass.js +9 -0
  19. data/lib/install/config/loaders/installers/angular.js +4 -0
  20. data/lib/install/config/loaders/installers/react.js +11 -0
  21. data/lib/install/config/loaders/installers/vue.js +10 -0
  22. data/lib/install/config/webpack/configuration.js +21 -0
  23. data/lib/install/config/webpack/development.js +16 -0
  24. data/lib/install/config/webpack/development.server.js +17 -0
  25. data/lib/install/config/webpack/development.server.yml +4 -0
  26. data/lib/install/config/webpack/paths.yml +19 -0
  27. data/lib/install/config/webpack/production.js +20 -0
  28. data/lib/install/config/webpack/shared.js +51 -0
  29. data/lib/install/{angular → examples/angular}/hello_angular.js +1 -1
  30. data/lib/install/{angular → examples/angular}/hello_angular/app/app.component.ts +0 -0
  31. data/lib/install/{angular → examples/angular}/hello_angular/app/app.module.ts +0 -0
  32. data/lib/install/{angular → examples/angular}/hello_angular/index.ts +0 -0
  33. data/lib/install/{angular → examples/angular}/hello_angular/polyfills.ts +0 -0
  34. data/lib/install/{angular → examples/angular}/tsconfig.json +0 -0
  35. data/lib/install/examples/react/.babelrc +3 -0
  36. data/lib/install/examples/react/hello_react.jsx +25 -0
  37. data/lib/install/examples/vue/app.vue +22 -0
  38. data/lib/install/examples/vue/hello_vue.js +19 -0
  39. data/lib/install/javascript/packs/application.js +1 -0
  40. data/lib/install/react.rb +15 -0
  41. data/lib/install/template.rb +20 -14
  42. data/lib/install/vue.rb +15 -0
  43. data/lib/tasks/installers.rake +21 -0
  44. data/lib/tasks/webpacker.rake +14 -107
  45. data/lib/tasks/webpacker/compile.rake +29 -0
  46. data/lib/tasks/webpacker/install.rake +12 -0
  47. data/lib/tasks/webpacker/verify_install.rake +16 -0
  48. data/lib/tasks/webpacker/yarn_install.rake +6 -0
  49. data/lib/webpacker.rb +1 -1
  50. data/lib/webpacker/configuration.rb +42 -0
  51. data/lib/webpacker/file_loader.rb +24 -0
  52. data/lib/webpacker/helper.rb +32 -3
  53. data/lib/webpacker/manifest.rb +29 -0
  54. data/lib/webpacker/railtie.rb +6 -16
  55. data/lib/webpacker/version.rb +3 -0
  56. data/package.json +28 -0
  57. data/webpacker.gemspec +15 -12
  58. data/yarn.lock +1014 -0
  59. metadata +50 -20
  60. data/lib/install/config/development.js +0 -24
  61. data/lib/install/config/production.js +0 -16
  62. data/lib/install/config/shared.js +0 -70
  63. data/lib/install/react/.babelrc +0 -3
  64. data/lib/install/react/hello_react.js +0 -16
  65. data/lib/webpacker/digests.rb +0 -42
  66. data/lib/webpacker/source.rb +0 -38
@@ -1,3 +1,4 @@
1
+ /* eslint no-console:0 */
1
2
  // This file is automatically compiled by Webpack, along with any other files
2
3
  // present in this directory. You're encouraged to place your actual application logic in
3
4
  // a relevant structure within app/javascript and only use these pack files to reference
@@ -0,0 +1,15 @@
1
+ require "webpacker/configuration"
2
+
3
+ puts "Copying react loader to #{Webpacker::Configuration.config_path}/loaders"
4
+ copy_file "#{__dir__}/config/loaders/installers/react.js", "config/webpack/loaders/react.js"
5
+
6
+ puts "Copying .babelrc to app root directory"
7
+ copy_file "#{__dir__}/examples/react/.babelrc", ".babelrc"
8
+
9
+ puts "Copying react example entry file to #{Webpacker::Configuration.entry_path}"
10
+ copy_file "#{__dir__}/examples/react/hello_react.jsx", "#{Webpacker::Configuration.entry_path}/hello_react.jsx"
11
+
12
+ puts "Installing all react dependencies"
13
+ run "./bin/yarn add react react-dom babel-preset-react"
14
+
15
+ puts "Webpacker now supports react.js 🎉"
@@ -1,23 +1,29 @@
1
- directory "#{__dir__}/javascript", 'app/javascript'
1
+ # Install webpacker
2
+ puts "Creating javascript app source directory"
3
+ directory "#{__dir__}/javascript", "app/javascript"
2
4
 
3
- directory "#{__dir__}/bin", 'bin'
4
- chmod 'bin', 0755 & ~File.umask, verbose: false
5
+ puts "Copying binstubs"
6
+ directory "#{__dir__}/bin", "bin"
7
+ chmod "bin", 0755 & ~File.umask, verbose: false
5
8
 
6
- directory "#{__dir__}/config", 'config/webpack'
9
+ puts "Copying webpack core config and loaders"
10
+ directory "#{__dir__}/config/webpack", "config/webpack"
11
+ directory "#{__dir__}/config/loaders/core", "config/webpack/loaders"
12
+ copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
7
13
 
8
- append_to_file '.gitignore', <<-EOS
14
+ append_to_file ".gitignore", <<-EOS
9
15
  /public/packs
10
16
  /node_modules
11
17
  EOS
12
18
 
13
- run './bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader glob'
19
+ puts "Installing all JavaScript dependencies"
20
+ run "./bin/yarn add webpack webpack-merge js-yaml path-complete-extname " \
21
+ "webpack-manifest-plugin babel-loader coffee-loader coffee-script " \
22
+ "babel-core babel-preset-env compression-webpack-plugin rails-erb-loader glob " \
23
+ "extract-text-webpack-plugin node-sass file-loader sass-loader css-loader style-loader " \
24
+ "postcss-loader autoprefixer postcss-smart-import precss"
14
25
 
15
- environment \
16
- "# Make javascript_pack_tag lookup digest hash to enable long-term caching\n" +
17
- " config.x.webpacker[:digesting] = true\n",
18
- env: 'production'
26
+ puts "Installing dev server for live reloading"
27
+ run "./bin/yarn add --dev webpack-dev-server"
19
28
 
20
- environment \
21
- "# Make javascript_pack_tag load assets from webpack-dev-server.\n" +
22
- " # config.x.webpacker[:dev_server_host] = \"http://localhost:8080\"\n",
23
- env: 'development'
29
+ puts "Webpacker successfully installed 🎉 🍰"
@@ -0,0 +1,15 @@
1
+ require "webpacker/configuration"
2
+
3
+ puts "Copying vue loader to #{Webpacker::Configuration.config_path}/loaders"
4
+ copy_file "#{__dir__}/config/loaders/installers/vue.js", "config/webpack/loaders/vue.js"
5
+
6
+ puts "Copying the example entry file to #{Webpacker::Configuration.entry_path}"
7
+ copy_file "#{__dir__}/examples/vue/hello_vue.js", "#{Webpacker::Configuration.entry_path}/hello_vue.js"
8
+
9
+ puts "Copying vue app file to #{Webpacker::Configuration.entry_path}"
10
+ copy_file "#{__dir__}/examples/vue/app.vue", "#{Webpacker::Configuration.entry_path}/app.vue"
11
+
12
+ puts "Installing all vue dependencies"
13
+ run "./bin/yarn add vue vue-loader vue-template-compiler sass-loader node-sass css-loader"
14
+
15
+ puts "Webpacker now supports vue.js 🎉"
@@ -0,0 +1,21 @@
1
+ INSTALLERS = {
2
+ "Angular": :angular,
3
+ "React": :react,
4
+ "Vue": :vue
5
+ }.freeze
6
+
7
+ namespace :webpacker do
8
+ namespace :install do
9
+ INSTALLERS.each do |name, task_name|
10
+ desc "Install everything needed for #{name}"
11
+ task task_name => ["webpacker:verify_install"] do
12
+ template = File.expand_path("../install/#{task_name}.rb", __dir__)
13
+ if Rails::VERSION::MAJOR >= 5
14
+ exec "./bin/rails app:template LOCATION=#{template}"
15
+ else
16
+ exec "./bin/rake rails:template LOCATION=#{template}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,108 +1,15 @@
1
- WEBPACKER_APP_TEMPLATE_PATH = File.expand_path('../install/template.rb', __dir__)
2
- REGEX_MAP = /\A.*\.map\z/
3
-
4
- namespace :webpacker do
5
- desc "Compile javascript packs using webpack for production with digests"
6
- task :compile => :environment do
7
- dist_dir = Rails.application.config.x.webpacker[:packs_dist_dir]
8
- result = `WEBPACK_DIST_DIR=#{dist_dir} NODE_ENV=production ./bin/webpack --json`
9
-
10
- exit! $?.exitstatus unless $?.success?
11
-
12
- webpack_digests = JSON.parse(result)['assetsByChunkName'].each_with_object({}) do |(chunk, file), h|
13
- h[chunk] = file.is_a?(Array) ? file.find {|f| REGEX_MAP !~ f } : file
14
- end.to_json
15
-
16
- digests_path = Rails.application.config.x.webpacker[:digests_path]
17
- packs_path = Rails.root.join('public', dist_dir) || File.dirname(digests_path)
18
- packs_digests_path = digests_path || Rails.root.join(packs_path, 'digests.json')
19
-
20
- FileUtils.mkdir_p(packs_path)
21
- File.open(packs_digests_path, 'w+') { |file| file.write webpack_digests }
22
-
23
- puts "Compiled digests for all packs in #{packs_digests_path}: "
24
- puts webpack_digests
25
- end
26
-
27
- desc "Install webpacker in this application"
28
- task :install do
29
- exec "./bin/rails app:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
30
- end
31
-
32
- namespace :install do
33
- desc "Install everything needed for react"
34
- task :react do
35
- config_path = Rails.root.join('config/webpack/shared.js')
36
- config = File.read(config_path)
37
-
38
- if config =~ /presets:\s*\[\s*\[\s*'latest'/
39
- puts "Replacing loader presets to include react in #{config_path}"
40
- config.gsub!(/presets:(\s*\[)(\s*)\[(\s)*'latest'/, "presets:\\1\\2'react',\\2[\\3'latest'")
41
- else
42
- puts "Couldn't automatically update loader presets in #{config_path}. Please set presets: [ 'react', [ 'latest', { 'es2015': { 'modules': false } } ] ]."
43
- end
44
-
45
- if config.include?("test: /\\.js(.erb)?$/")
46
- puts "Replacing loader test to include react in #{config_path}"
47
- config.gsub!("test: /\\.js(.erb)?$/", "test: /\\.jsx?(.erb)?$/")
48
- else
49
- puts "Couldn't automatically update loader test in #{config_path}. Please set test: /\.jsx?(.erb)?$/."
50
- end
51
-
52
- File.write config_path, config
53
-
54
- puts "Copying .babelrc to project directory"
55
- FileUtils.copy File.expand_path('../install/react/.babelrc', __dir__),
56
- Rails.root
57
-
58
- puts "Copying react example to app/javascript/packs/hello_react.js"
59
- FileUtils.copy File.expand_path('../install/react/hello_react.js', __dir__),
60
- Rails.root.join('app/javascript/packs/hello_react.js')
61
-
62
- exec './bin/yarn add --dev babel-preset-react && ./bin/yarn add react react-dom'
63
- end
64
-
65
- desc "Install everything needed for Angular"
66
- task :angular do
67
- config_path = Rails.root.join('config/webpack/shared.js')
68
- config = File.read(config_path)
69
-
70
- if config.include?('ts-loader')
71
- puts "The configuration file already has a reference to ts-loader, skipping the test rule..."
72
- else
73
- puts "Adding a loader rule to include ts-loader for .ts files in #{config_path}..."
74
- config.gsub!(/rules:(\s*\[)(\s*\{)/, "rules:\\1\\2 test: /\.ts$/, loader: 'ts-loader' },\\2")
75
- end
76
-
77
- if config =~ /["'].ts["']/
78
- puts "The configuration file already has a reference to .ts extension, skipping the addition of this extension to the list..."
79
- else
80
- puts "Adding '.ts' in loader extensions in #{config_path}..."
81
- config.gsub!(/extensions:(.*')(\s*\])/, "extensions:\\1, '.ts'\\2")
82
- end
83
-
84
- File.write config_path, config
85
-
86
- puts "Copying Angular example to app/javascript/packs/hello_angular.js"
87
- FileUtils.copy File.expand_path('../install/angular/hello_angular.js', __dir__),
88
- Rails.root.join('app/javascript/packs/hello_angular.js')
89
-
90
- puts "Copying Angular Hello app to app/javascript/hello_angular"
91
- FileUtils.copy_entry File.expand_path('../install/angular/hello_angular', __dir__),
92
- Rails.root.join('app/javascript/hello_angular')
93
-
94
- puts "Copying tsconfig.json to the Rails root directory"
95
- FileUtils.copy File.expand_path('../install/angular/tsconfig.json', __dir__),
96
- Rails.root.join('tsconfig.json')
97
-
98
- exec './bin/yarn add --dev typescript ts-loader && ./bin/yarn add "core-js zone.js rxjs @angular/core @angular/common @angular/compiler @angular/platform-browser @angular/platform-browser-dynamic"'
99
- end
100
- end
101
- end
102
-
103
- # Compile packs after we've compiled all other assets during precompilation
104
- if Rake::Task.task_defined?('assets:precompile')
105
- Rake::Task['assets:precompile'].enhance do
106
- Rake::Task['webpacker:compile'].invoke
107
- end
1
+ tasks = {
2
+ "webpacker:install" => "Installs and setup webpack with yarn",
3
+ "webpacker:compile" => "Compiles webpack bundles based on environment",
4
+ "webpacker:verify_install" => "Verifies if webpacker is installed",
5
+ "webpacker:yarn_install" => "Support for older Rails versions. Install all JavaScript dependencies as specified via Yarn",
6
+ "webpacker:install:react" => "Installs and setup example react component",
7
+ "webpacker:install:vue" => "Installs and setup example vue component",
8
+ "webpacker:install:angular" => "Installs and setup example angular2 component"
9
+ }.freeze
10
+
11
+ desc "Lists all available tasks in webpacker"
12
+ task :webpacker do
13
+ puts "Available webpacker tasks are:"
14
+ tasks.each { |task, message| puts task.ljust(30) + message }
108
15
  end
@@ -0,0 +1,29 @@
1
+ require "webpacker/configuration"
2
+ REGEX_MAP = /\A.*\.map\z/
3
+
4
+ namespace :webpacker do
5
+ desc "Compile javascript packs using webpack for production with digests"
6
+ task compile: ["webpacker:verify_install", :environment] do
7
+ puts "Compiling webpacker assets 🎉"
8
+ result = `NODE_ENV=production ./bin/webpack`
9
+
10
+ unless $?.success?
11
+ puts JSON.parse(result)["errors"]
12
+ exit! $?.exitstatus
13
+ end
14
+
15
+ puts "Compiled digests for all packs in #{Webpacker::Configuration.output_path}: "
16
+ puts JSON.parse(File.read(Webpacker::Configuration.manifest_path))
17
+ end
18
+ end
19
+
20
+ # Compile packs after we've compiled all other assets during precompilation
21
+ if Rake::Task.task_defined?("assets:precompile")
22
+ Rake::Task["assets:precompile"].enhance do
23
+ unless Rake::Task.task_defined?("yarn:install")
24
+ # For Rails < 5.1
25
+ Rake::Task["webpacker:yarn_install"].invoke
26
+ end
27
+ Rake::Task["webpacker:compile"].invoke
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ WEBPACKER_APP_TEMPLATE_PATH = File.expand_path("../../install/template.rb", __dir__)
2
+
3
+ namespace :webpacker do
4
+ desc "Install webpacker in this application"
5
+ task :install do
6
+ if Rails::VERSION::MAJOR >= 5
7
+ exec "./bin/rails app:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
8
+ else
9
+ exec "./bin/rake rails:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ require "webpacker/configuration"
2
+
3
+ namespace :webpacker do
4
+ desc "Verifies if webpacker is installed"
5
+ task :verify_install do
6
+ if File.exist?(Webpacker::Configuration.file_path)
7
+ puts "Webpacker is installed 🎉 🍰"
8
+ puts "Using #{Webpacker::Configuration.file_path} file for setting up webpack paths"
9
+ else
10
+ puts "Configuration config/webpack/paths.yml file not found. \n"\
11
+ "Make sure webpacker:install is run successfully before " \
12
+ "running dependent tasks"
13
+ exit!
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ namespace :webpacker do
2
+ desc "Support for older Rails versions.Install all JavaScript dependencies as specified via Yarn"
3
+ task :yarn_install do
4
+ system("./bin/yarn")
5
+ end
6
+ end
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  end
3
3
 
4
- require 'webpacker/railtie' if defined?(Rails)
4
+ require "webpacker/railtie" if defined?(Rails)
@@ -0,0 +1,42 @@
1
+ # Loads webpacker configuration from config/webpack/paths.yml
2
+ require "webpacker/file_loader"
3
+
4
+ class Webpacker::Configuration < Webpacker::FileLoader
5
+ class << self
6
+ def config_path
7
+ Rails.root.join(paths.fetch(:config, "config/webpack"))
8
+ end
9
+
10
+ def entry_path
11
+ Rails.root.join(source_path, paths.fetch(:entry, "packs"))
12
+ end
13
+
14
+ def file_path
15
+ Rails.root.join("config", "webpack", "paths.yml")
16
+ end
17
+
18
+ def manifest_path
19
+ Rails.root.join(output_path, "manifest.json")
20
+ end
21
+
22
+ def output_path
23
+ Rails.root.join(paths.fetch(:output, "public"), paths.fetch(:entry, "packs"))
24
+ end
25
+
26
+ def paths
27
+ load if Rails.env.development?
28
+ raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::Configuration.load must be called first") unless instance
29
+ instance.data
30
+ end
31
+
32
+ def source_path
33
+ Rails.root.join(paths.fetch(:source, "app/javascript"))
34
+ end
35
+ end
36
+
37
+ private
38
+ def load
39
+ return super unless File.exist?(@path)
40
+ HashWithIndifferentAccess.new(YAML.load(File.read(@path)))
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ # Provides a base singleton-configuration pattern for loading a file, given a path
2
+ class Webpacker::FileLoader
3
+ class NotFoundError < StandardError; end
4
+ class FileLoaderError < StandardError; end
5
+
6
+ class_attribute :instance
7
+ attr_accessor :data
8
+
9
+ class << self
10
+ def load(path = file_path)
11
+ self.instance = new(path)
12
+ end
13
+ end
14
+
15
+ private
16
+ def initialize(path)
17
+ @path = path
18
+ @data = load
19
+ end
20
+
21
+ def load
22
+ {}.freeze
23
+ end
24
+ end
@@ -1,8 +1,20 @@
1
- require 'webpacker/source'
1
+ require "webpacker/manifest"
2
2
 
3
3
  module Webpacker::Helper
4
+ # Computes the full path for a given webpacker asset.
5
+ # Return relative path using manifest.json and passes it to asset_url helper
6
+ # This will use asset_path internally, so most of their behaviors will be the same.
7
+ # Examples:
8
+ #
9
+ # In development mode:
10
+ # <%= asset_pack_path 'calendar.js' %> # => "/packs/calendar.js"
11
+ # In production mode:
12
+ # <%= asset_pack_path 'calendar.css' %> # => "/packs/calendar-1016838bab065ae1e122.css"
13
+ def asset_pack_path(name, **options)
14
+ asset_path(Webpacker::Manifest.lookup(name), **options)
15
+ end
4
16
  # Creates a script tag that references the named pack file, as compiled by Webpack per the entries list
5
- # in config/webpack/shared.js. By default, this list is auto-generated to match everything in
17
+ # in config/webpack/shared.js. By default, this list is auto-generated to match everything in
6
18
  # app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
7
19
  #
8
20
  # Examples:
@@ -15,6 +27,23 @@ module Webpacker::Helper
15
27
  # <%= javascript_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
16
28
  # <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
17
29
  def javascript_pack_tag(name, **options)
18
- javascript_include_tag(Webpacker::Source.new(name).path, **options)
30
+ javascript_include_tag(Webpacker::Manifest.lookup("#{name}#{compute_asset_extname(name, type: :javascript)}"), **options)
31
+ end
32
+
33
+ # Creates a link tag that references the named pack file, as compiled by Webpack per the entries list
34
+ # in config/webpack/shared.js. By default, this list is auto-generated to match everything in
35
+ # app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
36
+ #
37
+ # Examples:
38
+ #
39
+ # # In development mode:
40
+ # <%= stylesheet_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
41
+ # <link rel="stylesheet" media="screen" href="/packs/calendar.css" data-turbolinks-track="reload" />
42
+ #
43
+ # # In production mode:
44
+ # <%= stylesheet_pack_tag 'calendar', 'data-turbolinks-track': 'reload' %> # =>
45
+ # <link rel="stylesheet" media="screen" href="/packs/calendar-1016838bab065ae1e122.css" data-turbolinks-track="reload" />
46
+ def stylesheet_pack_tag(name, **options)
47
+ stylesheet_link_tag(Webpacker::Manifest.lookup("#{name}#{compute_asset_extname(name, type: :stylesheet)}"), **options)
19
48
  end
20
49
  end
@@ -0,0 +1,29 @@
1
+ # Singleton registry for accessing the packs path using generated manifest.
2
+ # This allows javascript_pack_tag, stylesheet_pack_tag, asset_pack_path to take a reference to,
3
+ # say, "calendar.js" or "calendar.css" and turn it into "/packs/calendar.js" or
4
+ # "/packs/calendar.css" in development. In production mode, it returns compiles
5
+ # files, # "/packs/calendar-1016838bab065ae1e314.js" and
6
+ # "/packs/calendar-1016838bab065ae1e314.css" for long-term caching
7
+
8
+ require "webpacker/file_loader"
9
+ require "webpacker/configuration"
10
+
11
+ class Webpacker::Manifest < Webpacker::FileLoader
12
+ class << self
13
+ def file_path
14
+ Webpacker::Configuration.manifest_path
15
+ end
16
+
17
+ def lookup(name)
18
+ load if Rails.env.development?
19
+ raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::Manifest.load must be called first") unless instance
20
+ instance.data[name.to_s] || raise(Webpacker::FileLoader::NotFoundError.new("Can't find #{name} in #{file_path}. Is webpack still compiling?"))
21
+ end
22
+ end
23
+
24
+ private
25
+ def load
26
+ return super unless File.exist?(@path)
27
+ JSON.parse(File.read(@path))
28
+ end
29
+ end