Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Fix issue w/ production CSS being generated in wrong order (Webpack) #946

Merged
merged 1 commit into from Apr 20, 2018

Conversation

jjhampton
Copy link
Member

Issue Resolved

Fixes #945 - caused by CSS being generated in out of order in production.

Description of changes

Updates the NPM dependency extract-text-webpack-plugin to v3.0.0, per the recommendation in the issue from the dependency repo here. Without the update, CSS files on production were being generated in the wrong order - bug was not occurring on dev environment served from webpack-dev-server.

To Test Locally

Code reviewers will want to test locally w/ the Webpack production build. I ran into some errors following the Quickstart Guide production steps, so I had to go thru the following steps:

  1. in server.js, comment out these lines:
// app.use((req, res, next) => {
//   if (req.headers['x-forwarded-proto'] !== 'https') {
//     return res.redirect(`https://${req.headers.host}${req.url}`);
//   }
//   return next();
// });
  1. Install new dependency version and build production:
    yarn
    yarn run build

  2. Start docker container:
    docker-compose up -d --build

  3. Visit http://localhost:80 to test the production build on the docker container server

Fixes issue w/ CSS bundled in wrong order on production
@apex-omontgomery
Copy link
Member

Jumped the gun for a moment.
https://gist.github.com/wimo7083/0cbca5cae162fb1241d82b637952d3ca

Still showing 300px. Attached is my deployment gist and image of reproduction.

image

@jjhampton
Copy link
Member Author

@wimo7083 - Strange, on line 70 of your Gist, in your Docker build, it says it's still using the old version of the dependency: extract-text-webpack-plugin@2.1.0 instead of v3.0 (the new one added to the package.json in the PR)

@jjhampton
Copy link
Member Author

@wimo7083 Here's a Gist of my local production build - https://gist.github.com/jjhampton/50879d654a763b02bfaeee0cb9a0723e

Mine didn't output the same output as yours for Step 8 / yarn install step of the Docker build (where yours had the warning about the old version extract-text-webpack-plugin@2.1.0) - my build just used some cached dependencies, apparently. Yesterday, I did have to initially repeat the production build steps several times just to get it working, though - maybe that's why somehow Docker or Yarn cached something. I'm not familiar enough with either to know how/why:

 Step 8/11 : RUN yarn install --no-progress
 ---> Using cache
 ---> 8b67a5339613

The CSS (and the signup form) do look correct on the docker container serving the production build on my machine. Can you try and repeat the build, perhaps? Or we could have someone else try and replicate - @kylemh ?

@kylemh kylemh merged commit ca28b55 into OperationCode:master Apr 20, 2018
@jjhampton jjhampton deleted the 945-webpack-css-order branch April 22, 2018 19:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signup form width too narrow / Submit button misaligned
3 participants