webpack-rails-react 1.0.13 → 1.0.14

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
  SHA1:
3
- metadata.gz: 0e1b93425cd75a378705ffbad219cbae249f6785
4
- data.tar.gz: dbd7af2f10bc25b7d07bc33fd04a8ec7c435a849
3
+ metadata.gz: 35479c0c57cd46faac4a2d608d98f24546031e70
4
+ data.tar.gz: b89eb8dac8f26131087b073b7e90fef81aacf12d
5
5
  SHA512:
6
- metadata.gz: ab16da0e2d58787fba80be3d6f2dbe87a5831db2c3d6828bc5259d67f89e63ba14d674d52de6c16fb6529217c8aa299f5b8b773ec80dbe2b15bccbf68a24a109
7
- data.tar.gz: 07a53432ebf98da14b47e8f1b0cbc9e07709e6cda66c449f916d4e5c480bcd76db38d87b2b9266aa34093ff1297a150d9adcffc554ee796d3a30ab82d1a91f33
6
+ metadata.gz: 40491d7178cae440da35016caadd07128e0921a82522781433f94c753e8577f7e82e3226f03301c522b5e69f78db303d026508e84bcfbad439826af3da5fc341
7
+ data.tar.gz: 7a6b18f4cd939ea8be2725d32aefb753c5ca455e43e03d6ea67c49a7d24f8f9a49ac404fe75e95ba149ec6016f05e836e51d4666573c1431459f23a4aa6e7de0
data/example/package.json CHANGED
@@ -4,7 +4,10 @@
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev_server": "./node_modules/.bin/webpack-dev-server --config config/webpack.config.js",
7
- "build": "webpack --config=config/webpack.config.js -p"
7
+ "build": "webpack --config=config/webpack.config.js -p",
8
+ "heroku-setup": "heroku buildpacks:clear && heroku buildpacks:set heroku/nodejs && heroku buildpacks:add heroku/ruby --index 2",
9
+ "webpack:deploy-heroku": "webpack --config=config/webpack.config.heroku.js -p",
10
+ "heroku-postbuild": "npm run webpack:deploy-heroku"
8
11
  },
9
12
  "dependencies": {
10
13
  "react": "^15.1.0",
@@ -0,0 +1,88 @@
1
+ // Example webpack configuration with asset fingerprinting in production.
2
+ 'use strict';
3
+
4
+ var path = require('path');
5
+ var webpack = require('webpack');
6
+ var StatsPlugin = require('stats-webpack-plugin');
7
+
8
+ // must match config.webpack.dev_server.port
9
+ var devServerPort = 3808;
10
+
11
+ // set TARGET=production on the environment to add asset fingerprints
12
+ var production = process.env.NODE_ENV === 'production';
13
+
14
+ var config = {
15
+ entry: {
16
+ // Sources are expected to live in $app_root/webpack
17
+ 'application': './webpack/application.js'
18
+ },
19
+
20
+ output: {
21
+ // Build assets directly in to public/webpack/, let webpack know
22
+ // that all webpacked assets start with webpack/
23
+
24
+ // must match config.webpack.output_dir
25
+ path: path.join(__dirname, '..', 'public', 'webpack'),
26
+ publicPath: '/webpack/',
27
+
28
+ filename: production ? '[name]-[chunkhash].js' : '[name].js'
29
+ },
30
+
31
+ resolve: {
32
+ root: path.join(__dirname, '..', 'webpack'),
33
+ extensions: ["", ".js", ".jsx", ".es6"]
34
+ },
35
+
36
+ module: {
37
+ loaders: [
38
+ {
39
+ test: /\.jsx?$/, // Match both .js and .jsx files
40
+ exclude: /node_modules/,
41
+ loader: "babel",
42
+ query:
43
+ {
44
+ presets:['es2015', 'react', 'stage-0']
45
+ }
46
+ },
47
+ {
48
+ test: /\.(jpe?g|png|gif|svg)$/i,
49
+ loaders: [
50
+ 'file?hash=sha512&digest=hex&name=[hash].[ext]',
51
+ 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
52
+ ]
53
+ }
54
+ ]
55
+ },
56
+
57
+ plugins: [
58
+ // must match config.webpack.manifest_filename
59
+ new StatsPlugin('manifest.json', {
60
+ // We only need assetsByChunkName
61
+ chunkModules: false,
62
+ source: false,
63
+ chunks: false,
64
+ modules: false,
65
+ assets: true
66
+ })]
67
+ };
68
+
69
+ if (production) {
70
+ config.plugins.push(
71
+ new webpack.NoErrorsPlugin(),
72
+ new webpack.DefinePlugin({
73
+ 'process.env': { NODE_ENV: JSON.stringify('production') }
74
+ }),
75
+ new webpack.optimize.DedupePlugin(),
76
+ new webpack.optimize.OccurenceOrderPlugin()
77
+ );
78
+ } else {
79
+ config.devServer = {
80
+ port: devServerPort,
81
+ headers: { 'Access-Control-Allow-Origin': '*' }
82
+ };
83
+ config.output.publicPath = '//localhost:' + devServerPort + '/webpack/';
84
+ // Source maps
85
+ config.devtool = 'cheap-module-eval-source-map';
86
+ }
87
+
88
+ module.exports = config;
@@ -43,6 +43,13 @@ var config = {
43
43
  {
44
44
  presets:['es2015', 'react', 'stage-0']
45
45
  }
46
+ },
47
+ {
48
+ test: /\.(jpe?g|png|gif|svg)$/i,
49
+ loaders: [
50
+ 'file?hash=sha512&digest=hex&name=[hash].[ext]',
51
+ 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
52
+ ]
46
53
  }
47
54
  ]
48
55
  },
@@ -39,6 +39,7 @@ module WebpackRailsReact
39
39
 
40
40
  def copy_webpack_conf
41
41
  copy_file "webpack.config.js", "config/webpack.config.js"
42
+ copy_file "webpack.config.heroku.js", "config/webpack.config.heroku.js"
42
43
  end
43
44
 
44
45
  def create_webpack_application_js
@@ -119,6 +120,10 @@ module WebpackRailsReact
119
120
  This must be the very last route in your routes.rb file
120
121
  e.g. get '*unmatched_route', to: 'home#index'
121
122
 
123
+ FOR HEROKU DEPLOYS:
124
+ 1. npm run heroku-setup
125
+ 2. Push to heroku the post-build hook will take care of the rest
126
+
122
127
  See the README.md for this gem at
123
128
  https://github.com/cottonwoodcoding/webpack-rails-react/blob/master/README.md
124
129
  for more info.
@@ -2,7 +2,7 @@ module Webpack
2
2
  # :nodoc:
3
3
  module Rails
4
4
  module React
5
- VERSION = "1.0.13"
5
+ VERSION = "1.0.14"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpack-rails-react
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.13
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Jungst
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-20 00:00:00.000000000 Z
12
+ date: 2016-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -55,6 +55,7 @@ files:
55
55
  - example/boilerplate/views/rails_view.html.erb
56
56
  - example/dot_gitignore
57
57
  - example/package.json
58
+ - example/webpack.config.heroku.js
58
59
  - example/webpack.config.js
59
60
  - lib/generators/webpack_rails_react/install_generator.rb
60
61
  - lib/generators/webpack_rails_react/view_generator.rb
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  version: '0'
86
87
  requirements: []
87
88
  rubyforge_project:
88
- rubygems_version: 2.4.5
89
+ rubygems_version: 2.5.1
89
90
  signing_key:
90
91
  specification_version: 4
91
92
  summary: Webpack / Rails / React