ctrlplusb / react-universally

A starter kit for universal react applications.
MIT License
1.7k stars 244 forks source link

Bug: Order of ExtractTextPlugin #493

Open mschipperheyn opened 7 years ago

mschipperheyn commented 7 years ago

I spent quite a bit of time with a failing Dokku deploy which gave the error:

ERROR in Error: Child compilation failed: Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example

In my code I use style imports like so: import styles from './styles'

The problem was caused by the fact that ExtractTextPlugin ran after Uglify.

Changing to

  // For our production client we need to make sure we pass the required
  // configuration to ensure that the output is minimized/optimized.
  ifProdClient(
    () =>
      new webpack.LoaderOptionsPlugin({
        minimize: true,
      }),
  ),

  // For the production build of the client we need to extract the CSS into
  // CSS files.
  ifProdClient(
    () =>
      new ExtractTextPlugin({
        filename: '[name]-[contenthash].css',
        allChunks: true,
      }),
  ),

solved my issue. I'm assuming it has something to do with the css being used in-line as code. Prob got uglified before extraction or something like that.

mschipperheyn commented 7 years ago

Hmm, getting it to work seems to have been a fluke. Back to the same error. This was not the solution

verenea commented 6 years ago

Did you happen to come across a solution to your issue? I have been experiencing the same thing for nearly a day, have implemented every solution I can reasonably think of and have exhausted googles search result combinations of ETP/scss/Child compilation failed/etc...

oyeanuj commented 6 years ago

@mschipperheyn @verenea Did any of you find a solution to this? I'm also seeing this error on adding some external CSS.

verenea commented 6 years ago

I did... though it was a situation where I'd been grinding and trial-n-error testing for so long that I can't say for sure exactly what it was... I made like 3 potential fixes all at once and it built very late into the night, so claimed victory . If you have any way I can review some code we could compare ... or I can share a trimmed version of my project as well.

On Oct 29, 2017, at 4:52 PM, Anuj notifications@github.com wrote:

@mschipperheyn @verenea Did any of you find a solution to this? I'm also seeing this error on adding some external CSS.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.