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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 424ff35c639d4bee63718a652cc6c469dcf41df2bf8be43c1ca2c8b4dd447ff4
4
- data.tar.gz: c8315b80b06f863d885c6456382925bf7e384b88d8720543ecf3d4d242bd6032
3
+ metadata.gz: 6ad36061853da6bc28a9c71225733606a7e026d18c396afec3da6fe90df7e8c3
4
+ data.tar.gz: 287bd10275fecb58304ad2b663c416f001cb0a8b81197312e3ed890913600987
5
5
  SHA512:
6
- metadata.gz: 14d18d8d5ebca6d15050a5f195a9563dad64ae1b6a4d097bed29812f29aa6b740af16c27250fa04673e7e0d873441a004eadf9865374b5bbdcb92b288ce3ff71
7
- data.tar.gz: 85474365d6ffc853695abeff0690eeae4e80f7d9b0d1e79d9e2924aed2a47b013fe6961bd2ac332ebab4a8aad07be3e910773f6df5b711956eaa60a7f48db48b
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"
@@ -60,7 +60,7 @@ module.exports = (env, options) => {
60
60
  {
61
61
  loader: 'url-loader',
62
62
  options: {
63
- limit: 8192,
63
+ limit: false,
64
64
  name: devMode ? '[name].[ext]' : '[name]-[hash:7].[ext]'
65
65
  },
66
66
  },
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module WebpackNative
2
- VERSION = "0.3.6"
2
+ VERSION = "0.4.3"
3
3
  end
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.6
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-07 00:00:00.000000000 Z
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!