vue_rails 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cee19e48acaf336b33fed08dc05f37a55824587acc06b4f1111aa11e2a519d7
4
- data.tar.gz: 698c7c1359a9e69faf47fca07bfef8c9febe8da6babc7abd729004da88e23d1f
3
+ metadata.gz: 8ce1fc3479bd7e217c1d9ac459aaa1543f7aa13e2898dde049c8e7625de8e8fb
4
+ data.tar.gz: da670c878e6e1c92aa554d65663cfbfa79069583c6578b3b4bc7623e6f5f7253
5
5
  SHA512:
6
- metadata.gz: 7477e47ee84c8cdaa70dc94908d8706fb696eadd8e76320a9f7ce2cacac344cbd2acef330d0eff7df506fbd3052c8521f0db8c46918653bf5ce3a382b55c300e
7
- data.tar.gz: 8d492c26048c52ac8a998803609f09cf244757bf9c5ad4f4e9c5df6ebd2c82bb88ed07fdcbc0ec895a7f694fe7e9f28543b2fbf96f2e6a8a7bba6eed2a60fb7c
6
+ metadata.gz: 509844941163539a2427895838fbdfab8f09a752e345074548bacf477e26f732f6884a07ca362919d341185f06b6c6de81e954d8d0682c14d4cea917ac8b88bc
7
+ data.tar.gz: a4ba967c51e6277ee1c756df27724bdb557cf87514a13d28eec11f626afe7b57c60329c81b97511876e2ad03ec184fbbeeb784864c0c5510a6d6627350b10cd5
@@ -24,7 +24,8 @@ self.RailsVueUJS = RailsVueUJS;
24
24
  remove_file "#{javascript_dir}/app.vue"
25
25
  remove_file "#{javascript_packs_dir}/hello_vue.js"
26
26
  template "vue_ujs/hello.vue", "#{javascript_dir}/vue_components/hello.vue"
27
- `yarn add vue-server-renderer`
27
+ template "vue_ujs/environment_with_ssr.js", "#{Rails.root}/config/webpack/environment_with_ssr.js"
28
+ `yarn add vue-server-renderer null-loader`
28
29
  end
29
30
  end
30
31
  end
@@ -91,9 +91,17 @@ module VueRails
91
91
  end
92
92
  end
93
93
 
94
- def output_path
95
- # Webpack1 /:output/:entry, Webpack3 /public/:output
96
- config.respond_to?(:output_path) ? config.output_path : 'public'
94
+ if MAJOR < 4
95
+ def output_path
96
+ # Webpack1 /:output/:entry, Webpack3 /public/:output
97
+ config.respond_to?(:output_path) ? config.output_path : 'public'
98
+ end
99
+ else
100
+ def output_path
101
+ config.public_output_path
102
+ end
97
103
  end
104
+
105
+
98
106
  end
99
107
  end
@@ -4,7 +4,13 @@ module VueRails
4
4
  class Renderer
5
5
  GLOBAL_WRAPPER = <<-JS
6
6
  var global = global || this;
7
+ global['process'] = global['process'] || {}
8
+ global['process']['env'] = {
9
+ VUE_ENV: 'server',
10
+ NODE_ENV: 'production'
11
+ }
7
12
  var self = self || this;
13
+ var window = undefined;
8
14
  JS
9
15
 
10
16
  CONSOLE_POLYFILL = <<-JS
@@ -1,3 +1,3 @@
1
1
  module VueRails
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,35 @@
1
+ const { environment } = require('@rails/webpacker')
2
+ const { VueLoaderPlugin } = require('vue-loader')
3
+ const vue = require('./loaders/vue')
4
+
5
+ environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
6
+
7
+ environment.loaders.prepend('vue', vue);
8
+
9
+ module.exports = {
10
+ toWebpackConfig () {
11
+ return [webpackConfig, webpackConfigForServer]
12
+ }
13
+ }
14
+
15
+ let webpackConfig = environment.toWebpackConfig();
16
+ let webpackConfigForServer = Object.assign({}, webpackConfig);
17
+ let _entry = Object.assign({}, webpackConfig.entry);
18
+ webpackConfig.entry = {};
19
+
20
+ Object.keys(_entry).forEach((entry_key) => {
21
+ if (entry_key === "vue_server_render") {
22
+ let _module = Object.assign({}, webpackConfig.module);
23
+ _module.rules = Object.assign([], webpackConfig.module.rules);
24
+ _module.rules.unshift({
25
+ test: /\.(c|sa|sc)ss$/,
26
+ loader: 'null-loader'
27
+ });
28
+ webpackConfigForServer.module = _module;
29
+ webpackConfigForServer.entry = {};
30
+ webpackConfigForServer.entry[entry_key] = _entry[entry_key];
31
+ webpackConfigForServer.devServer = {}
32
+ } else {
33
+ webpackConfig.entry[entry_key] = _entry[entry_key];
34
+ }
35
+ });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vue_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 纪亚荣
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-28 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,6 +124,7 @@ files:
124
124
  - lib/vue_rails/version.rb
125
125
  - lib/vue_rails/view_helper.rb
126
126
  - vue_on_rails.gemspec
127
+ - vue_ujs/environment_with_ssr.js
127
128
  - vue_ujs/hello.vue
128
129
  - vue_ujs/vue_ujs.js
129
130
  homepage: https://github.com/jiyarong/vue_rails