react_on_rails 9.0.0.beta.10 → 9.0.0.beta.11
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/CHANGELOG.md +29 -22
- data/Gemfile +1 -1
- data/lib/generators/react_on_rails/base_generator.rb +1 -1
- data/lib/generators/react_on_rails/templates/base/base/config/webpacker.yml +5 -6
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- data/webpackConfigLoader.js +19 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 152c5b1177a2a18b4f42911852dc05e8d317ca1d
|
4
|
+
data.tar.gz: d4d456575c0bc79630f9f2ae6df6b38e241437e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8e80dc096f8aac19a20abcc62e7b8a2b249a036fdf933a59cff68e2b3dc6e2521c411e37ce6774b65a5ba2d37bc3fb63e11e1b651eb1c1be53c78b7ca8be7b6
|
7
|
+
data.tar.gz: ece4de2349632633fce5f2a070713a39e686dac7fe34150112455085ee7d91cc6c303608358c8bbed07840f82dd82809e8e39b3628dca49fad9955cec40da50e
|
data/CHANGELOG.md
CHANGED
@@ -18,7 +18,7 @@ All 9.0.0 beta versions can be viewed in [PR 908](https://github.com/shakacode/r
|
|
18
18
|
|
19
19
|
```rb
|
20
20
|
gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
21
|
-
branch: "issue-464-merge-webpacker-lite-into-webpacker-
|
21
|
+
branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
|
22
22
|
```
|
23
23
|
|
24
24
|
- Update for the renaming in the `WebpackConfigLoader` in your webpack configuration.
|
@@ -36,27 +36,31 @@ gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
|
36
36
|
- Edit your Webpack.config files:
|
37
37
|
- Change your Webpack output to be like:
|
38
38
|
```
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
```
|
39
|
+
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
|
40
|
+
const configPath = resolve('..', 'config');
|
41
|
+
const { output, settings } = webpackConfigLoader(configPath);
|
42
|
+
const devBuild = process.env.NODE_ENV !== 'production';
|
43
|
+
|
45
44
|
output: {
|
46
|
-
|
47
|
-
|
45
|
+
filename: isHMR ? '[name]-[hash].js' : '[name]-[chunkhash].js',
|
46
|
+
chunkFilename: '[name]-[chunkhash].chunk.js',
|
48
47
|
|
49
48
|
publicPath: output.publicPath,
|
50
49
|
path: output.path,
|
51
50
|
},
|
51
|
+
```
|
52
|
+
- Change your ManifestPlugin definition to something like the following
|
53
|
+
```
|
54
|
+
new ManifestPlugin({
|
55
|
+
publicPath: output.publicPath,
|
56
|
+
writeToFileEmit: true
|
57
|
+
}),
|
52
58
|
|
53
59
|
```
|
54
|
-
|
55
60
|
|
56
61
|
- Find your `webpacker_lite.yml` and rename it to `webpacker.yml`
|
57
62
|
- Add a default setting
|
58
63
|
```
|
59
|
-
custom_compile: true
|
60
64
|
cache_manifest: false
|
61
65
|
```
|
62
66
|
- For production, set:
|
@@ -70,6 +74,7 @@ gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
|
70
74
|
port: 3035
|
71
75
|
hmr: false
|
72
76
|
```
|
77
|
+
Set hmr to your preference.
|
73
78
|
- See the example `spec/dummy/config/webpacker.yml`.
|
74
79
|
- Remove keys `hot_reloading_host` and `hot_reloading_enabled_by_default`. These are replaced by the `dev_server` key.
|
75
80
|
- Rename `webpack_public_output_dir` to `public_output_path`.
|
@@ -744,17 +749,19 @@ Best done with Object destructing:
|
|
744
749
|
##### Fixed
|
745
750
|
- Fix several generator related issues.
|
746
751
|
|
747
|
-
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/rails-webpacker...9.0.0-beta.
|
748
|
-
[9.0.0]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.
|
749
|
-
[9.0.0-beta.
|
750
|
-
[9.0.0-beta.
|
751
|
-
[9.0.0-beta.
|
752
|
-
[9.0.0-beta.
|
753
|
-
[9.0.0-beta.
|
754
|
-
[9.0.0-beta.
|
755
|
-
[9.0.0-beta.
|
756
|
-
[9.0.0-beta.
|
757
|
-
[9.0.0-beta.
|
752
|
+
[Unreleased]: https://github.com/shakacode/react_on_rails/compare/rails-webpacker...9.0.0-beta.11
|
753
|
+
[9.0.0]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.11
|
754
|
+
[9.0.0-beta.11]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.10...9.0.0-beta.11
|
755
|
+
[9.0.0-beta.10]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.9...9.0.0-beta.10
|
756
|
+
[9.0.0-beta.9]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.8...9.0.0-beta.9
|
757
|
+
[9.0.0-beta.8]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.7...9.0.0-beta.8
|
758
|
+
[9.0.0-beta.7]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.6...9.0.0-beta.7
|
759
|
+
[9.0.0-beta.6]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.5...9.0.0-beta.6
|
760
|
+
[9.0.0-beta.5]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.4...9.0.0-beta.5
|
761
|
+
[9.0.0-beta.4]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.3...9.0.0-beta.4
|
762
|
+
[9.0.0-beta.3]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.2...9.0.0-beta.3
|
763
|
+
[9.0.0-beta.2]: https://github.com/shakacode/react_on_rails/compare/9.0.0-beta.1...9.0.0-beta.2
|
764
|
+
[9.0.0-beta.1]: https://github.com/shakacode/react_on_rails/compare/master...9.0.0-beta.1
|
758
765
|
[8.0.6]: https://github.com/shakacode/react_on_rails/compare/8.0.5...8.0.6
|
759
766
|
[8.0.5]: https://github.com/shakacode/react_on_rails/compare/8.0.3...8.0.5
|
760
767
|
[8.0.3]: https://github.com/shakacode/react_on_rails/compare/8.0.2...8.0.3
|
data/Gemfile
CHANGED
@@ -39,7 +39,7 @@ gem "launchy"
|
|
39
39
|
gem "poltergeist"
|
40
40
|
gem "selenium-webdriver"
|
41
41
|
gem "webpacker", git: "https://github.com/shakacode/webpacker.git",
|
42
|
-
branch: "issue-464-merge-webpacker-lite-into-webpacker-
|
42
|
+
branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
|
43
43
|
|
44
44
|
# TODO: remove once we get out of beta.
|
45
45
|
# gem 'webpacker', path: "../../forks/webpacker"
|
@@ -75,7 +75,7 @@ module ReactOnRails
|
|
75
75
|
|
76
76
|
gem 'mini_racer', platforms: :ruby
|
77
77
|
gem 'webpacker', git: "https://github.com/shakacode/webpacker.git",
|
78
|
-
branch: "issue-464-merge-webpacker-lite-into-webpacker-
|
78
|
+
branch: "issue-464-merge-webpacker-lite-into-webpacker-v5"
|
79
79
|
GEMS
|
80
80
|
append_to_file("Gemfile",
|
81
81
|
gems)
|
@@ -11,15 +11,14 @@ development:
|
|
11
11
|
# generated files for development, in /public/webpack/development
|
12
12
|
public_output_path: webpack/development
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# hmr: false
|
14
|
+
dev_server:
|
15
|
+
host: localhost
|
16
|
+
port: 3035
|
17
|
+
hmr: true
|
19
18
|
|
20
19
|
test:
|
21
20
|
<<: *default
|
22
|
-
# generated files for
|
21
|
+
# generated files for test, in /public/webpack/test
|
23
22
|
public_output_path: webpack/test
|
24
23
|
|
25
24
|
production:
|
data/package.json
CHANGED
data/webpackConfigLoader.js
CHANGED
@@ -16,13 +16,23 @@ function removeOuterSlashes(string) {
|
|
16
16
|
return string.replace(/^\/*/, '').replace(/\/*$/, '');
|
17
17
|
}
|
18
18
|
|
19
|
-
function formatPublicPath(
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
function formatPublicPath(settings) {
|
20
|
+
if (settings.dev_server) {
|
21
|
+
const host = settings.dev_server.host;
|
22
|
+
const port = settings.dev_server.port;
|
23
|
+
const path = settings.public_output_path;
|
24
|
+
const hostWithHttp = `http://${host}:${port}`;
|
25
|
+
|
26
|
+
let formattedHost = removeOuterSlashes(hostWithHttp);
|
27
|
+
if (formattedHost && !/^http/i.test(formattedHost)) {
|
28
|
+
formattedHost = `//${formattedHost}`;
|
29
|
+
}
|
30
|
+
const formattedPath = removeOuterSlashes(path);
|
31
|
+
return `${formattedHost}/${formattedPath}/`;
|
23
32
|
}
|
24
|
-
|
25
|
-
|
33
|
+
|
34
|
+
const publicOuterPathWithoutOutsideSlashes = removeOuterSlashes(settings.public_output_path);
|
35
|
+
return `//${publicOuterPathWithoutOutsideSlashes}/`;
|
26
36
|
}
|
27
37
|
|
28
38
|
/**
|
@@ -33,12 +43,12 @@ function formatPublicPath(host = '', path = '') {
|
|
33
43
|
* @returns {{
|
34
44
|
settings,
|
35
45
|
resolvedModules,
|
36
|
-
output: { path, publicPath,
|
46
|
+
output: { path, publicPath, publicPathWithHost }
|
37
47
|
}}
|
38
48
|
*/
|
39
49
|
const configLoader = (configPath) => {
|
40
50
|
// Some test environments might not have the NODE_ENV set, so we'll have fallbacks.
|
41
|
-
const configEnv = (
|
51
|
+
const configEnv = (env.NODE_ENV || env.RAILS_ENV || 'development');
|
42
52
|
const ymlConfigPath = join(configPath, 'webpacker.yml');
|
43
53
|
const settings = safeLoad(readFileSync(ymlConfigPath, 'utf8'))[configEnv];
|
44
54
|
|
@@ -48,7 +58,7 @@ const configLoader = (configPath) => {
|
|
48
58
|
// the relative path.
|
49
59
|
path: resolve(configPath, '..', 'public', settings.public_output_path),
|
50
60
|
publicPath: `/${settings.public_output_path}/`.replace(/([^:]\/)\/+/g, '$1'),
|
51
|
-
publicPathWithHost: formatPublicPath(
|
61
|
+
publicPathWithHost: formatPublicPath(settings),
|
52
62
|
};
|
53
63
|
|
54
64
|
return {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.0.beta.
|
4
|
+
version: 9.0.0.beta.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|