webpackrails 1.1.0 → 1.1.1
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/README.md +7 -2
- data/bin/console +1 -1
- data/lib/webpackrails/railtie.rb +4 -0
- data/lib/webpackrails/version.rb +1 -1
- data/lib/webpackrails/webpack_processor.rb +11 -2
- metadata +20 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0081116fb0874979c577700157e819ea57cdcc
|
4
|
+
data.tar.gz: 3994b6732d8ff2083721aac8250ecc6352c00020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788ec74d3e1238cf985917bdbb2145728b4cfc3583fceaacd3c4480497edca7b5f8fd09523633079a7e692153d65d3aa45ccffd6b2b63fb89d17d65a36482238
|
7
|
+
data.tar.gz: 6ce1a1504900ae41d1f66aae578498ab222423351c2a4a95952c5e228a8af78d98bdbf1671b6938f3fd1aaaf2512a22f977656f7505f3e8ce220c523278ca83a
|
data/README.md
CHANGED
@@ -32,7 +32,8 @@ Create `package.json` in your Rails root:
|
|
32
32
|
}
|
33
33
|
```
|
34
34
|
|
35
|
-
Run `npm i` to install the dependencies.
|
35
|
+
Run `npm i` to install the dependencies. **Make sure the `railshot-webpack-plugin` is
|
36
|
+
in the dependencies instead of `devDependencies`**.
|
36
37
|
|
37
38
|
## Usage
|
38
39
|
|
@@ -41,7 +42,7 @@ webpack config file within `application.rb`
|
|
41
42
|
|
42
43
|
`config.webpackrails.config_file = "path_to_the_config_file"`
|
43
44
|
|
44
|
-
|
45
|
+
#### Watch file for changes
|
45
46
|
|
46
47
|
Use webpack plugin `railshot-webpack-plugin` in your `webpack.config.js`.
|
47
48
|
If you haven't install the plugin yet, run `npm install railshot-webpack-plugin`.
|
@@ -59,6 +60,10 @@ module.exports = {
|
|
59
60
|
}
|
60
61
|
```
|
61
62
|
|
63
|
+
#### Troubleshooting
|
64
|
+
|
65
|
+
[Wiki troubleshooting](https://github.com/towry/webpackrails/wiki/Troubleshooting)
|
66
|
+
|
62
67
|
### Config
|
63
68
|
|
64
69
|
See [source](https://raw.githubusercontent.com/towry/webpackrails/master/lib/webpackrails/railtie.rb)
|
data/bin/console
CHANGED
data/lib/webpackrails/railtie.rb
CHANGED
@@ -19,6 +19,10 @@ module WebpackRails
|
|
19
19
|
# ignore node_modules
|
20
20
|
config.webpackrails.ignore_node_modules = true
|
21
21
|
|
22
|
+
# array of string to test if the file need to be process by this gem.
|
23
|
+
# see `commonjs_module?` method
|
24
|
+
config.webpackrails.force_condition = []
|
25
|
+
|
22
26
|
initializer :setup_webpack do |app|
|
23
27
|
app.assets.register_postprocessor "application/javascript", WebpackRails::WebpackProcessor
|
24
28
|
end
|
data/lib/webpackrails/version.rb
CHANGED
@@ -49,7 +49,7 @@ module WebpackRails
|
|
49
49
|
# make sure the temp dir exists
|
50
50
|
def ensure_tmp_dir_exists!
|
51
51
|
FileUtils.mkdir_p(rails_path(tmp_path))
|
52
|
-
@deps_path
|
52
|
+
@deps_path ||= File.join(tmp_path, '_$webpackrails_dependencies');
|
53
53
|
end
|
54
54
|
|
55
55
|
# Filter out node_module/ files
|
@@ -124,7 +124,12 @@ module WebpackRails
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def commonjs_module?
|
127
|
-
|
127
|
+
return false if !data.present?
|
128
|
+
|
129
|
+
condition = ["module.exports", "require", "import", "export", "exports", "export default", "React"]
|
130
|
+
data_s = data.to_s
|
131
|
+
|
132
|
+
(condition + config.force_condition).uniq.any? { |c| data_s.include?(c) }
|
128
133
|
end
|
129
134
|
|
130
135
|
def asset_paths
|
@@ -154,6 +159,10 @@ module WebpackRails
|
|
154
159
|
base_directory = File.dirname(file)
|
155
160
|
|
156
161
|
Logger::log "\nWebpack: #{command}"
|
162
|
+
|
163
|
+
mut_env = ENV.to_hash
|
164
|
+
mut_env.merge!(env)
|
165
|
+
ENV.replace(mut_env)
|
157
166
|
stdout, stderr, status = Open3.capture3(env, command, stdin_data: data, chdir: base_directory)
|
158
167
|
|
159
168
|
if !status.success?
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpackrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- towry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sprockets
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: tilt
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Webpack + Rails ≠ CommonJS Heaven
|
@@ -115,7 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
118
|
+
- ".gitignore"
|
119
119
|
- CODE_OF_CONDUCT.md
|
120
120
|
- Gemfile
|
121
121
|
- LICENSE.txt
|
@@ -142,19 +142,18 @@ require_paths:
|
|
142
142
|
- lib
|
143
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
154
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.4.
|
155
|
+
rubygems_version: 2.4.7
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Make Webpack work with Rails for you
|
159
159
|
test_files: []
|
160
|
-
has_rdoc:
|