Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daniel/webpacker integration #811

Closed

Conversation

kaizencodes
Copy link
Contributor

@kaizencodes kaizencodes commented Apr 19, 2017

  • Updated generators, templates and tests
  • Updated dummy app (wip: css not loading)

This change is Reviewable

@justin808
Copy link
Member

Great start!!!!


Reviewed 26 of 26 files at r1.
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/client/webpackConfigLoader.js, line 15 at r1 (raw file):

  paths,
  publicPath,
};

@kaizencodes Should we put this in the node library?

so we don't have to include this with the generator?

I think so.

If this is in the library, we can have the exports come from a function call, so that if the configuration place is different, it can be set, or if the webpack config is in a different place.

Essentially, have this be the default config path, but allow overriding it.


lib/generators/react_on_rails/templates/base/base/config/webpack/paths.yml, line 19 at r1 (raw file):

production:
  <<: *default
  assets: webpack/production

this is AWESOME

cc: @robwise, @alexfedoseev, @samnang


spec/dummy/client/webpack.client.base.config.js, line 20 at r1 (raw file):

} catch (ex) {
  console.error(ex);
  console.log('Make sure the client build (client.base.build or client.rails.build) creates a manifest in:', manifestPath);

this line is maybe too wide, definitely we want to try to fi lines under 100 chars wide


spec/dummy/client/webpack.client.base.config.js, line 39 at r1 (raw file):

    //   paths.source,
    //   paths.node_modules,
    // ],

remove comment?


spec/dummy/client/webpackConfigLoader.js, line 22 at r1 (raw file):

  paths,
  publicPath,
};

this could come from the node file, just like the generator file

so that would DRY up things


spec/dummy/config/initializers/react_on_rails.rb, line 100 at r1 (raw file):

  # For any asset matching this regex, a file is copied to the correct path to have a digest.
  # To disable creating digested assets, set this parameter to nil.
  config.symlink_non_digested_assets_regex = nil

that needs to be the default for new projects --> did that change for the generator?

In fact, we should consider removing this from generated file, and the default is nil.

I think for here, it's OK to specify it. However, that will not confirm that the default is nil, possibly.


Comments from Reviewable

@robwise
Copy link
Contributor

robwise commented Apr 19, 2017

Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/config/webpack/paths.yml, line 2 at r1 (raw file):

default: &default
  config: client/webpack

I still don't get how I set it to build two configs (server-rendering and client). I've said this over and over and no one ever responds. Why does webpacker even need to know about my webpack config?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/config/webpack/paths.yml, line 2 at r1 (raw file):

Previously, robwise (Rob Wise) wrote…

I still don't get how I set it to build two configs (server-rendering and client). I've said this over and over and no one ever responds. Why does webpacker even need to know about my webpack config?

@robwise It needs to know where the manifest file is, to include the assets. Why wouldn't it work for 2 configs? Does the output differ?


Comments from Reviewable

@robwise
Copy link
Contributor

robwise commented Apr 19, 2017

Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/config/webpack/paths.yml, line 2 at r1 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

@robwise It needs to know where the manifest file is, to include the assets. Why wouldn't it work for 2 configs? Does the output differ?

@kaizencodes It wouldn't work for two configs because it only takes a single string as an argument and not an array, so how do I put two configs there? We have a server bundle config and a client bundles config for server rendering. We also have a DLL config for development. Which one of the three do I put here? What happens to the other two?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/config/webpack/paths.yml, line 2 at r1 (raw file):

Previously, robwise (Rob Wise) wrote…

@kaizencodes It wouldn't work for two configs because it only takes a single string as an argument and not an array, so how do I put two configs there? We have a server bundle config and a client bundles config for server rendering. We also have a DLL config for development. Which one of the three do I put here? What happens to the other two?

@robwise Okay, now I get where you are getting at. First of this was meant to show a dir path where all the configs are located. But we don't use this 'config' key anymore (Should have deleted it already). The procfiles load the appropriate configs, each loads this shared file.


Comments from Reviewable

@justin808
Copy link
Member

@kaizencodes Let's delete any unnecessary configs, and also make it clear in the comments of the config files that webpacker_lite differs from webpacker in that you have to provide your own config.

@kaizencodes
Copy link
Contributor Author

Shouldn't it be better to place this info in the webpacker_lite readme?


Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/client/webpackConfigLoader.js, line 15 at r1 (raw file):

Previously, justin808 (Justin Gordon) wrote…

@kaizencodes Should we put this in the node library?

so we don't have to include this with the generator?

I think so.

If this is in the library, we can have the exports come from a function call, so that if the configuration place is different, it can be set, or if the webpack config is in a different place.

Essentially, have this be the default config path, but allow overriding it.

I'm not sure how this would fit in the node package.


spec/dummy/config/initializers/react_on_rails.rb, line 100 at r1 (raw file):

Previously, justin808 (Justin Gordon) wrote…

that needs to be the default for new projects --> did that change for the generator?

In fact, we should consider removing this from generated file, and the default is nil.

I think for here, it's OK to specify it. However, that will not confirm that the default is nil, possibly.

nil is the default. However, This is from the template:

config.symlink_non_digested_assets_regex = /\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/

Comments from Reviewable

@justin808
Copy link
Member

Couple questions


Reviewed 3 of 3 files at r2.
Review status: all files reviewed at latest revision, 9 unresolved discussions, some commit checks broke.


spec/dummy/client/webpack.client.base.config.js, line 19 at r2 (raw file):

  sharedManifest = require(manifestPath);
} catch (ex) {
  console.log('No manifest found. It will be created at:', manifestPath);

I'm not clear on this code or the error message. Please explain. What is the sharedManifest variable for? Seems to be some sort of caching thing.


spec/dummy/client/webpack.server.rails.build.config.js, line 22 at r2 (raw file):

} catch (ex) {
  console.error(ex);
  console.log('No manifest found. It will be created at:', manifestPath);

is this error ever expected, as in the first time this is run?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 9 unresolved discussions, some commit checks broke.


spec/dummy/client/webpack.client.base.config.js, line 19 at r2 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I'm not clear on this code or the error message. Please explain. What is the sharedManifest variable for? Seems to be some sort of caching thing.

Yes, it is caching. When we use 2 configs like client and server, each will write to the manifest. However, if we do not include the hash created by the first, the second will overwrite it.


spec/dummy/client/webpack.server.rails.build.config.js, line 22 at r2 (raw file):

Previously, justin808 (Justin Gordon) wrote…

is this error ever expected, as in the first time this is run?

yes, it occurs with the first config always.


Comments from Reviewable

@justin808
Copy link
Member

Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/client/webpackConfigLoader.js, line 15 at r1 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

I'm not sure how this would fit in the node package.

This could be a non-default import in the node package.

import webpackConfigLoader from 'react-on-rails/webpackConfigLoader'


spec/dummy/client/webpack.client.base.config.js, line 19 at r2 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

Yes, it is caching. When we use 2 configs like client and server, each will write to the manifest. However, if we do not include the hash created by the first, the second will overwrite it.

Maybe the message should only be printed if in a debugging mode? Maybe the message should be clear that this prints the first time the config is run?


Comments from Reviewable

@justin808
Copy link
Member

some comments


Reviewed 12 of 12 files at r3.
Review status: all files reviewed at latest revision, 14 unresolved discussions, some commit checks broke.


lib/generators/react_on_rails/templates/base/base/client/webpack.config.js, line 7 at r3 (raw file):

const webpack = require('webpack');
const { resolve } = require('path');
const ManifestPlugin = require('webpack-manifest-plugin'); // eslint-disable-line import/no-unresolved

This seems odd to need the eslint disable here. Any idea on why?


lib/generators/react_on_rails/templates/base/base/client/webpackConfigLoader.js, line 15 at r1 (raw file):

Previously, justin808 (Justin Gordon) wrote…

This could be a non-default import in the node package.

import webpackConfigLoader from 'react-on-rails/webpackConfigLoader'

@robwise what do you think about putting this in the react-on-rails package?

The one issue is that we'd have to pass in a param of the location of the config/webpack/paths.yml file.


spec/dummy/app/views/layouts/application.html.erb, line 24 at r1 (raw file):

  <!-- These do use turbolinks -->
  <%= javascript_pack_tag('vendor',
                          'data-turbolinks-track': true) %>

why are we removing the turbo tag?


spec/dummy/app/views/layouts/application.html.erb, line 20 at r3 (raw file):

  <!-- This is to load the hot assets. -->

  <!-- These do use turbolinks -->

should this comment be here


spec/dummy/client/webpack.client.base.config.js, line 37 at r3 (raw file):

    alias: {
      images: join(process.cwd(), 'app', 'assets', 'images'),
      'react-on-rails': resolve(__dirname, '..', '..', '..'),

this seems odd b/c we also have react-on-rails listed in the package.json


spec/dummy/client/webpack.server.rails.build.config.js, line 39 at r3 (raw file):

    alias: {
      images: join(process.cwd(), 'app', 'assets', 'images'),
      'react-on-rails': resolve(__dirname, '..', '..', '..'),

this seems odd b/c we also have react-on-rails listed in the package.json


spec/dummy/config/initializers/assets.rb, line 14 at r3 (raw file):

# Add folder with webpack generated assets to assets.paths
Rails.application.config.assets.paths << Rails.root.join("public", "webpack", Rails.env)

very nice!

this needs to be well documented!

is this in the generator as well?

it should be!


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

development:
  <<: *default
  enabled: false

so you're turning off hot reloading?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: 24 of 29 files reviewed at latest revision, 14 unresolved discussions, some commit checks failed.


lib/generators/react_on_rails/templates/base/base/client/webpack.config.js, line 7 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

This seems odd to need the eslint disable here. Any idea on why?

eslint couldn't resolve it. Which is understandable given we don't have the package in the generator.


spec/dummy/client/webpack.client.base.config.js, line 37 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

this seems odd b/c we also have react-on-rails listed in the package.json

yes, it is needed when we require it locally.


spec/dummy/client/webpack.server.rails.build.config.js, line 39 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

this seems odd b/c we also have react-on-rails listed in the package.json

yes, it is needed when we require it locally.


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

so you're turning off hot reloading?

worked with static last time, hot loading should be the default?


Comments from Reviewable

@justin808
Copy link
Member

Reviewed 6 of 6 files at r4.
Review status: all files reviewed at latest revision, 17 unresolved discussions, some commit checks failed.


lib/generators/react_on_rails/base_generator.rb, line 62 at r4 (raw file):

           Procfile.dev
           package.json
           client/package.json).each { |file| template("#{base_path}#{file}.tt", file, force: true) }

I think this is going to blow away any existing application.html.erb.

The generator will be used on existing projects.

How about we make a new layout and set that in the controller for hello_world?


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

          'extensions: [\'.js\', \'.jsx\'],
            alias: {
              \'react-on-rails\': resolve(__dirname, \'..\', \'..\', \'..\', \'..\'),

I don't get why we need an alias for this.

The generators will generate code that depend on the release of react-on-rails corresponding to the gem version.


lib/generators/react_on_rails/templates/base/base/app/views/layouts/application.html.erb.tt, line 10 at r4 (raw file):

    <%%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    <%%= javascript_pack_tag 'main' %>
  </head>

This file can be renamed so as not to conflict with any existing application.html.erb.


lib/generators/react_on_rails/templates/base/base/client/webpack.config.js, line 7 at r3 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

eslint couldn't resolve it. Which is understandable given we don't have the package in the generator.

hmmm....we don't want the generated code to have that unnecessary disable. I think we can add the package globally /package.json


spec/dummy/client/webpack.client.base.config.js, line 37 at r3 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

yes, it is needed when we require it locally.

@kaizencodes But we didn't change this for 7.0, so we should not be adding this.


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

worked with static last time, hot loading should be the default?

I'm really not sure on this one.

Can this setting be overriden with an env value?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 17 unresolved discussions, some commit checks failed.


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I don't get why we need an alias for this.

The generators will generate code that depend on the release of react-on-rails corresponding to the gem version.

I don't get it either, yet without it react-on-rails fails to resolve.


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I'm really not sure on this one.

Can this setting be overriden with an env value?

We could. Should we?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 17 unresolved discussions, some commit checks failed.


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

I don't get it either, yet without it react-on-rails fails to resolve.

this is what I get on master:

ERROR in ./app/bundles/HelloWorld/startup/registration.jsx
Module not found: Error: Can't resolve 'react-on-rails' in '/home/daniel/rails/react_on_rails/gen-examples/examples/redux-server-rendering/client/app/bundles/HelloWorld/startup'
 @ ./app/bundles/HelloWorld/startup/registration.jsx 3:20-45
 @ multi es5-shim/es5-shim es5-shim/es5-sham babel-polyfill ./app/bundles/HelloWorld/startup/registration

Comments from Reviewable

@kaizencodes kaizencodes force-pushed the daniel/webpacker_integration branch from 1abd20a to 9c3926f Compare April 23, 2017 17:58
@kaizencodes
Copy link
Contributor Author

Review status: 27 of 32 files reviewed at latest revision, 17 unresolved discussions.


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

We could. Should we?

We should, this caused the travis error. I've set up the config loader to overwrite this value when REACT_ON_RAILS_ENV is HOT. Now the question comes: Do we need this? Is there a scenario where we need the dev server but not hot reload?


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

rebased onto master


Review status: 27 of 32 files reviewed at latest revision, 17 unresolved discussions.


Comments from Reviewable

@justin808
Copy link
Member

more comments


Reviewed 6 of 6 files at r5.
Review status: all files reviewed at latest revision, 20 unresolved discussions, some commit checks failed.


.eslintignore, line 15 at r5 (raw file):

**/coverage/**
**/cable.js
gen-examples/**/webpack.config.js

I don't think we should do this. It's good to lint these.

Did you try installing at the top level, the missing dependency?


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

this is what I get on master:

ERROR in ./app/bundles/HelloWorld/startup/registration.jsx
Module not found: Error: Can't resolve 'react-on-rails' in '/home/daniel/rails/react_on_rails/gen-examples/examples/redux-server-rendering/client/app/bundles/HelloWorld/startup'
 @ ./app/bundles/HelloWorld/startup/registration.jsx 3:20-45
 @ multi es5-shim/es5-shim es5-shim/es5-sham babel-polyfill ./app/bundles/HelloWorld/startup/registration

this is odd

We definitely can't put this in.

For one, the generator won't work outside of within the REact on Rails source!


lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb, line 2 at r5 (raw file):

class HelloWorldController < ApplicationController
  layout "hello_world"

I think we should rename all the "hello_world" to "hello_react_on_rails"


lib/generators/react_on_rails/templates/base/base/client/webpack.config.js, line 7 at r3 (raw file):

Previously, justin808 (Justin Gordon) wrote…

hmmm....we don't want the generated code to have that unnecessary disable. I think we can add the package globally /package.json

hey, package should be in the generated package.json. Maybe that's the issue. And not a dev, but a regular dependency.


spec/dummy/client/webpackConfigLoader.js, line 10 at r5 (raw file):

const devServerConfig = join(configPath, 'development.server.yml');
const devServer = safeLoad(readFileSync(devServerConfig, 'utf8')).development;

let's put a comment in the yml file about this env value

and I still want this whole thing in the node package


spec/dummy/client/webpackConfigLoader.js, line 14 at r5 (raw file):

if (env.REACT_ON_RAILS_ENV == "HOT") {
  devServer.enabled = true
}

excellent!


spec/dummy/config/webpack/development.server.yml, line 8 at r3 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

We should, this caused the travis error. I've set up the config loader to overwrite this value when REACT_ON_RAILS_ENV is HOT. Now the question comes: Do we need this? Is there a scenario where we need the dev server but not hot reload?

hot == dev server


Comments from Reviewable

@kaizencodes
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 20 unresolved discussions, some commit checks failed.


lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb, line 2 at r5 (raw file):

Previously, justin808 (Justin Gordon) wrote…

I think we should rename all the "hello_world" to "hello_react_on_rails"

Should we? it's all over the place


Comments from Reviewable

@justin808
Copy link
Member

getting there! see comments


Reviewed 19 of 19 files at r6.
Review status: all files reviewed at latest revision, 31 unresolved discussions, some commit checks failed.


package.json, line 44 at r6 (raw file):

  },
  "browser": {
    "fs": false

what is this part for?


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

this is odd

We definitely can't put this in.

For one, the generator won't work outside of within the REact on Rails source!

did you figure this out? maybe I can help today.


lib/generators/react_on_rails/dev_tests_generator.rb, line 55 at r6 (raw file):

      #                  old_contents.gsub(sentinel, FALLBACK_OPTION_FOR_NODE_MODULES)
      #   File.open(config, "w+") { |f| f.puts new_contents }
      # end

remove comments?


lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb, line 2 at r5 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

Should we? it's all over the place

actually, this could be a separate PR -- keep this the same for now


lib/generators/react_on_rails/templates/base/base/client/webpack.config.js, line 8 at r6 (raw file):

const { resolve } = require('path');
const ManifestPlugin = require('webpack-manifest-plugin');
const webpackConfigLoader = require('react-on-rails').default.webpackConfigLoader; // eslint-disable-line import/no-unresolved

any way we can get this to pass without the eslint issue? I think maybe we can list react-on-rails in the top level package.json, and use a relative file ref

and we need to change this

instead the require needs to be like

const configLoader = require('react-on-rails/configLoader');

rather than the default


lib/generators/react_on_rails/templates/base/base/config/webpack/development.server.yml, line 8 at r6 (raw file):

development:
  <<: *default
  enabled: false

we should put a comment here to make hot reloading the default, you can change this line to true

something like that, that is clear and short


node_package/src/ReactOnRails.js, line 11 at r6 (raw file):

import createReactElement from './createReactElement';
import Authenticity from './Authenticity';
import webpackConfigLoader from './webpackConfigLoader';

we need to remove this

instead the require needs to be like

require('react-on-rails/configLoader')

rather than the default


node_package/src/ReactOnRails.js, line 227 at r6 (raw file):

  },

  webpackConfigLoader(configPath) {

this should not go in the default react on rails package


node_package/src/webpackConfigLoader.js, line 8 at r6 (raw file):

export default {
  configLoader(configPath) {
    // const configPath = resolve('..', 'config', 'webpack');

remove comments

const configLoader = (configPath) => {

  return something;
} 

export default configLoader;

spec/dummy/client/webpack.client.base.config.js, line 40 at r6 (raw file):

    alias: {
      images: join(process.cwd(), 'app', 'assets', 'images'),
      // 'react-on-rails': resolve(__dirname, '..', '..', '..'),

remove comments


spec/dummy/client/webpack.client.rails.hot.config.js, line 11 at r6 (raw file):

const config = require('./webpack.client.base.config');
const webpackConfigLoader = require('react-on-rails').default.webpackConfigLoader;

see comments above


spec/dummy/client/webpack.server.rails.build.config.js, line 40 at r6 (raw file):

    alias: {
      images: join(process.cwd(), 'app', 'assets', 'images'),
      // 'react-on-rails': resolve(__dirname, '..', '..', '..'),

remove comments


spec/react_on_rails/generators/dev_tests_generator_spec.rb, line 47 at r6 (raw file):

    #     assert_match(expected, contents)
    #   end
    # end

remove?


Comments from Reviewable

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 97.951% when pulling 0b18d2b on kaizencodes:daniel/webpacker_integration into 6194e31 on shakacode:master.

@kaizencodes
Copy link
Contributor Author

Review status: 27 of 38 files reviewed at latest revision, 31 unresolved discussions, some commit checks failed.


package.json, line 44 at r6 (raw file):

Previously, justin808 (Justin Gordon) wrote…

what is this part for?

couldn't resolve fs that is in the configLoader


lib/generators/react_on_rails/dev_tests_generator.rb, line 56 at r4 (raw file):

Previously, justin808 (Justin Gordon) wrote…

did you figure this out? maybe I can help today.

yes I did, needed to run npm i on the react-on-rails package. which is odd as it seems the rake tasks should do that.


spec/react_on_rails/generators/dev_tests_generator_spec.rb, line 47 at r6 (raw file):

Previously, justin808 (Justin Gordon) wrote…

remove?

I wasn't sure if we need this somewhere or not


Comments from Reviewable

@justin808
Copy link
Member

Good progress. Definitely some more to do!


Reviewed 1 of 19 files at r6, 11 of 11 files at r7.
Review status: all files reviewed at latest revision, 27 unresolved discussions, some commit checks failed.


package.json, line 44 at r6 (raw file):

Previously, kaizencodes (Daniel Szatmari) wrote…

couldn't resolve fs that is in the configLoader

yes -- this should be removed, so that we're not loading the config file in the browser.


rakelib/run_rspec.rake, line 125 at r7 (raw file):

def gen_assets(dir)
  path = calc_path(dir)
  sh_in_dir(path.realpath, "yarn run build:test")

this might be OK for a bit

we need to investigate if the test helper can do this automatically


spec/dummy/client/server-rails-hot.js, line 22 at r7 (raw file):

import webpackConfig from './webpack.client.rails.hot.config';

const webpackConfigLoader = require('react-on-rails').default.webpackConfigLoader;

this should be a relative require


spec/dummy/client/webpack.server.rails.build.config.js, line 11 at r7 (raw file):

const { env, paths, publicPath } = webpackConfigLoader(resolve('..', 'config', 'webpack'));

const configPath = resolve('..', 'config', 'webpack');
const { env, paths, publicPath } = webpackConfigLoader(configPath);

spec/dummy/config/initializers/react_on_rails.rb, line 21 at r7 (raw file):

  # Define the files we need to check for webpack compilation when running tests.
  config.webpack_generated_files = %w(app-bundle.js vendor-bundle.js server-bundle.js)

we should not be removing the css files! those should be generated


Comments from Reviewable

@justin808
Copy link
Member

Review status: all files reviewed at latest revision, 27 unresolved discussions, some commit checks failed.


spec/dummy/config/initializers/react_on_rails.rb, line 21 at r7 (raw file):

Previously, justin808 (Justin Gordon) wrote…

we should not be removing the css files! those should be generated

Actually, we didn't have them there before.


Comments from Reviewable

@kaizencodes kaizencodes force-pushed the daniel/webpacker_integration branch from 0b18d2b to e77d098 Compare April 30, 2017 09:13
kaizencodes and others added 14 commits April 30, 2017 10:46
- add alias for gen examples
* Any version mismatch of gem and node package throws an error.
* 6.9 introduced code that would parse the props into a Hash
  unnecessarily. Any customers with significant String props took a
  performance hit from this on page rendering.
* Fix is to only put props inside of the script tag, and not any meta
  data, like the dom id and name of the component. This avoids unnecessary parsing.
* No need to use babel on this file
* Add another .eslintrc to avoid error on missing require
* Configured package.json to export the file webpackConfigLoader.js
* New default dir reflects generators
@justin808
Copy link
Member

I grabbed your latest commit and rebased my branch on master.

PENDING:

justin808 and others added 7 commits April 30, 2017 11:00
This should result in no pending changes after tests run locally.
* Removed unnecessary rake task for running specs
* Fixed inconsistency with using "-bundle" only some of the time.
* Removed unused node_modules value in paths.yml
* Upgraded to webpacker_lite 1.0.0
* Added CHANGELOG.md entry
* New default for symlink_non_digested_assets_regex is nil for
webpacker_lite default.

Previously:
      symlink_non_digested_assets_regex:
/\.(png|jpg|jpeg|gif|tiff|woff|ttf|eot|svg|map)/,
@kaizencodes kaizencodes force-pushed the daniel/webpacker_integration branch from e77d098 to ceaeb7e Compare May 3, 2017 16:55
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 97.967% when pulling 4688123 on kaizencodes:daniel/webpacker_integration into 4c4a27f on shakacode:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 97.967% when pulling 4688123 on kaizencodes:daniel/webpacker_integration into 4c4a27f on shakacode:master.

@justin808
Copy link
Member

Review status: 21 of 48 files reviewed at latest revision, 29 unresolved discussions, some commit checks failed.


docs/basics/migrating-to-webpacker.md, line 38 at r12 (raw file):

4. Add the manifest
[plugin](https://github.com/danethurber/webpack-manifest-plugin) to your webpack config

you never closed this

if you looked at your file as rendered in markdown, this is obvious.


docs/basics/migrating-to-webpacker.md, line 44 at r12 (raw file):

  Where `publicPath` is the webpack output directory.

5. (optional) use the react on rails configLoader
const webpackConfigLoader = require('react-on-rails/webpackConfigLoader');
const configPath = resolve('..', 'config', 'webpack');
const { paths, publicPath } = webpackConfigLoader(configPath);

Comments from Reviewable

@justin808
Copy link
Member

This PR is still open b/c of the doc commit. @kaizencodes Please move that to a new PR.

@justin808
Copy link
Member

Closing since this was merged in #822 and we have #835 open.

@justin808 justin808 closed this May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants