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

Update to Webpack v2 and Yarn (#336) #367

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

kaizencodes
Copy link
Contributor

@kaizencodes kaizencodes commented Mar 25, 2017

Eslint still fails due to the webpack resolver, couldn't solve it atm. I'll look into it later.

  • Replaced npm calls to yarn
  • updated package.json to webpack and all dependencies
  • updated config files to use webpack2 syntax
  • updated docs
  • updated travis config for yarn

This change is Reviewable

@kaizencodes kaizencodes force-pushed the feature/update_webpack_yarn branch from a193e1a to 323dce3 Compare March 25, 2017 19:46
@justin808
Copy link
Member

@kaizencodes Great start. Looking forward to this one!

@kaizencodes kaizencodes force-pushed the feature/update_webpack_yarn branch from 323dce3 to a782d07 Compare March 27, 2017 10:46
@kaizencodes
Copy link
Contributor Author

kaizencodes commented Mar 27, 2017

Had to upgrade eslint-import-resolver-webpack. All good now. I believe this also solves #364.
@justin808 Let me know if you need anything else for this one.

@reconstructions
Copy link
Contributor

reconstructions commented Mar 27, 2017

@justin808, I submitted PR #336 to resolve #364 before I saw this, feel free to ignore it if this fixes the issue.

@justin808
Copy link
Member

:lgtm:

@kaizencodes @reconstructions I'm going to merge #336 first. Then let's apply this.


Reviewed 21 of 21 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@kaizencodes kaizencodes force-pushed the feature/update_webpack_yarn branch from a782d07 to 338b8e8 Compare March 31, 2017 06:55
@justin808
Copy link
Member

Odd files added.


Reviewed 5 of 5 files at r2.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


client/package_BACKUP_3418.json, line 2 at r2 (raw file):

{
  "name": "react-webpack-rails-tutorial",

delete this file?


client/package_BASE_3418.json, line 2 at r2 (raw file):

{
  "name": "react-webpack-rails-tutorial",

what's this file?


Comments from Reviewable

- Replaced npm calls to yarn
- updated package.json to webpack and all dependencies
- updated config files to use webpack2 syntax
- updated docs
- updated travis config for yarn
@kaizencodes kaizencodes force-pushed the feature/update_webpack_yarn branch from 338b8e8 to ddfba00 Compare March 31, 2017 07:34
@kaizencodes
Copy link
Contributor Author

kaizencodes commented Mar 31, 2017

It must have been generated when I resolved the conflict, I didn't think it would do something like this.
Removed them.

@justin808
Copy link
Member

:lgtm:


Reviewed 2 of 4 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@justin808
Copy link
Member

Great job @kaizencodes! Thanks!

@justin808 justin808 merged commit 001a3ae into shakacode:master Mar 31, 2017
@kaizencodes kaizencodes deleted the feature/update_webpack_yarn branch March 31, 2017 08:49
@szyablitsky
Copy link
Contributor

szyablitsky commented Apr 1, 2017

@justin808 @kaizencodes this PR broke hot-reloading with css-loader. Imported styles are not there anymore with Procfile.dev, but they are present with Procfile.static or production build.

Another issue is an error

[sass-resources-loader]:  `options.context` is missing. Using current working directory as a root instead: /home/user/projects/react-webpack-rails-tutorial/client

which is printed out in log for every imported css module.

Any suggestions how to fix these issues?

@szyablitsky
Copy link
Contributor

Last one can be fixed by adding context: __dirname, inside of

new webpack.LoaderOptionsPlugin({
  options: {
   // Place here all postCSS plugins here, so postcss-loader will apply them
   postcss: [autoprefixer],
   // Place here all SASS files with variables, mixins etc.
   // And sass-resources-loader will load them in every CSS Module (SASS file) for you
   // (so don't need to @import them explicitly)
   // https://github.com/shakacode/sass-resources-loader
   sassResources: ['./app/assets/styles/app-variables.sass'],
   context: __dirname,
},

@justin808
Copy link
Member

@szyablitsky Please feel free to submit a PR. 😄

@justin808
Copy link
Member

@Judahmeek is working on hot reloading. He can comment here.

@szyablitsky
Copy link
Contributor

szyablitsky commented Apr 1, 2017

I'm not sure that using webpack.LoaderOptionsPlugin for context is the right way to go. Because webpack documentaton says:

The LoaderOptionsPlugin is unlike other plugins. It exists to help people move from webpack 1 to webpack 2.
Until a loader has been updated to depend upon options being passed directly to them, the LoaderOptionsPlugin exists to bridge the gap.
In the future this plugin may be removed

There must be other way to provide context option. But I'm not sure where it should be. BTW @justin808 what is the reason of its existence at first place? Can we just use process.cwd() everywhere?

@justin808
Copy link
Member

@justin808
Copy link
Member

@szyablitsky Yes, we should not be using the LoaderOptionsPlugin if we can avoid it. Are we using it in the /spec/dummy of the ReactOnRails repo?

'sass',
'sass-resources',
use: [
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'style-loader' is absent
hot reloading is not working because of it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szyablitsky or @kaizencodes can you please submit a PR?

@szyablitsky
Copy link
Contributor

@justin808 #373

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