diff --git a/package.json b/package.json index 7fc4d76e..bd9d3faa 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "eslint-plugin-prettier": "^2.0.1", "eslint-plugin-react": "^6.10.3", "exports-loader": "0.6.3", + "extract-text-webpack-plugin": "1.0.1", "fbemitter": "^2.1.1", "file-loader": "0.9.0", "flow-typed": "^2.1.2", diff --git a/webpack.config.dev.js b/webpack.config.dev.js index 2a569fed..a09773b9 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -1,6 +1,7 @@ /* eslint-disable */ var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); const commonWebpackConfig = require('./webpack.config'); @@ -18,6 +19,7 @@ const developmentWebpackConfig = Object.assign(commonWebpackConfig, { developmentWebpackConfig.plugins.push( new webpack.optimize.OccurenceOrderPlugin() ); +developmentWebpackConfig.plugins.push(new ExtractTextPlugin('styles.css')); developmentWebpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); developmentWebpackConfig.plugins.push(new webpack.NoErrorsPlugin()); developmentWebpackConfig.plugins.push( diff --git a/webpack.config.js b/webpack.config.js index 1be0fdfd..f99b890c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ /* eslint-disable */ const path = require('path'); const webpack = require('webpack'); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); require('dotenv').config({ silent: true }); @@ -40,7 +41,7 @@ module.exports = { }, { test: /\.css$/, - loader: 'style-loader!css-loader?sourceMap', + loader: ExtractTextPlugin.extract('style-loader', 'css-loader'), }, { test: /\.md/, loader: 'raw-loader' }, ], diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 5f593eb5..0dc51e6c 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -20,6 +20,9 @@ productionWebpackConfig.plugins.push( template: 'server/static/index.html', }) ); +productionWebpackConfig.plugins.push( + new ExtractTextPlugin('styles.[hash].css') +); productionWebpackConfig.plugins.push( new webpack.optimize.OccurenceOrderPlugin() ); diff --git a/yarn.lock b/yarn.lock index f446a475..3b83cf3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -306,7 +306,7 @@ async@^0.9.0: version "0.9.2" resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" -async@^1.3.0, async@^1.4.0: +async@^1.3.0, async@^1.4.0, async@^1.5.0: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -3035,6 +3035,14 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" +extract-text-webpack-plugin@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/extract-text-webpack-plugin/-/extract-text-webpack-plugin-1.0.1.tgz#c95bf3cbaac49dc96f1dc6e072549fbb654ccd2c" + dependencies: + async "^1.5.0" + loader-utils "^0.2.3" + webpack-sources "^0.1.0" + extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -5298,7 +5306,7 @@ load-json-file@^2.0.0: pify "^2.0.0" strip-bom "^3.0.0" -loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.14, loader-utils@~0.2.5: +loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.14, loader-utils@^0.2.3, loader-utils@~0.2.5: version "0.2.17" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" dependencies: @@ -8190,7 +8198,7 @@ source-map@0.5.6: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" -source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0, source-map@~0.5.1: +source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -9100,6 +9108,13 @@ webpack-hot-middleware@2.x: querystring "^0.2.0" strip-ansi "^3.0.0" +webpack-sources@^0.1.0: + version "0.1.5" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.5.tgz#aa1f3abf0f0d74db7111c40e500b84f966640750" + dependencies: + source-list-map "~0.1.7" + source-map "~0.5.3" + webpack@1.13.2: version "1.13.2" resolved "https://registry.yarnpkg.com/webpack/-/webpack-1.13.2.tgz#f11a96f458eb752970a86abe746c0704fabafaf3"