webpack_native 0.3.6 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/webpack_native/dev_generator.rb +2 -0
- data/lib/generators/webpack_native/prod_generator.rb +1 -0
- data/lib/generators/webpack_native/templates/webpack_native/webpack.config.js +1 -1
- data/lib/webpack_native/railtie.rb +27 -0
- data/lib/webpack_native/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad36061853da6bc28a9c71225733606a7e026d18c396afec3da6fe90df7e8c3
|
4
|
+
data.tar.gz: 287bd10275fecb58304ad2b663c416f001cb0a8b81197312e3ed890913600987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe266d6d53234d024a267a4051abb767646774ddad9c552109a24bc8d43d4a3ce6876bf8fe492d2639d1df3d5cbdbfd6fc36dbc1ec6e77eb4b3a38433841c212
|
7
|
+
data.tar.gz: efe3fd512deab0d06dcd58c720ef0abea880dd2b936a9df9182e1ea65095cc81b58f27d738a989603e945dc4642992b708bdcb2d5d0593fd503e7a71704d3fc1
|
@@ -6,6 +6,8 @@ class WebpackNative::DevGenerator < Rails::Generators::Base
|
|
6
6
|
|
7
7
|
Mutex.new.synchronize do
|
8
8
|
Dir.chdir "#{Rails.root}/app/webpack_native" do
|
9
|
+
Dir.mkdir('src/images') unless Dir.exist?('src/images')
|
10
|
+
%x{ yarn install }
|
9
11
|
result = %x{ npm run build:dev }
|
10
12
|
puts "\n"
|
11
13
|
puts result
|
@@ -6,6 +6,7 @@ class WebpackNative::ProdGenerator < Rails::Generators::Base
|
|
6
6
|
|
7
7
|
Mutex.new.synchronize do
|
8
8
|
Dir.chdir "#{Rails.root}/app/webpack_native" do
|
9
|
+
Dir.mkdir('src/images') unless Dir.exist?('src/images')
|
9
10
|
%x{ yarn install }
|
10
11
|
result = %x{ npm run build:prod }
|
11
12
|
puts "\n"
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rails'
|
2
2
|
require "open3"
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
class WebpackNative::Railtie < ::Rails::Railtie
|
5
6
|
|
@@ -7,10 +8,36 @@ class WebpackNative::Railtie < ::Rails::Railtie
|
|
7
8
|
WebpackNative.logger = ActiveSupport::Logger.new(STDOUT)
|
8
9
|
end
|
9
10
|
|
11
|
+
# Zeitwerk raise an error: set_autoloads_in_dir': wrong constant name Path-dirname inferred by Module from directory (Zeitwerk::NameError) ---> app/webpack_native/node_modules/path-dirname
|
12
|
+
# to prevent Zeitwerk from eager loading webpack_native folder we use this:
|
13
|
+
initializer "zeitwerk_prevent_loading_webpack_native" do
|
14
|
+
if Rails.autoloaders.zeitwerk_enabled?
|
15
|
+
Rails.autoloaders.main.ignore(Rails.root.join('app/webpack_native'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
10
19
|
initializer "webpack_native_set_manifest" do
|
11
20
|
if Rails.env.production?
|
21
|
+
|
22
|
+
# create public/webpack_native if it doesn't exist:
|
23
|
+
|
24
|
+
webpack_native_folder = "#{Rails.root}/public/webpack_native"
|
25
|
+
|
26
|
+
unless File.directory?(webpack_native_folder)
|
27
|
+
FileUtils.mkdir_p(webpack_native_folder)
|
28
|
+
end
|
29
|
+
|
30
|
+
# create manifest.json file if it doesn't exist with an empty json {} to prevent raising error in WebpackNativeHelper.load_webpack_manifest if a restart of a service happen (i.e delayed_job restart) that causes rails to load
|
31
|
+
|
32
|
+
manifest_path = "#{Rails.root}/public/webpack_native/manifest.json"
|
33
|
+
|
34
|
+
unless File.file?(manifest_path)
|
35
|
+
FileUtils.touch manifest_path
|
36
|
+
File.write manifest_path, "{}"
|
37
|
+
end
|
12
38
|
require_relative 'webpack_native_helper'
|
13
39
|
Rails.configuration.x.webpack_native.webpack_manifest_file = WebpackNative::WebpackNativeHelper.load_webpack_manifest
|
40
|
+
|
14
41
|
end
|
15
42
|
end
|
16
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpack_native
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- scratchoo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Use vanilla webpack to manage your assets efficiently, no webpacker or
|
14
14
|
asset pipeline anymore!
|