Skip to content
This repository was archived by the owner on May 21, 2020. It is now read-only.

Commit 5c0c652

Browse files
committed
fix(webpack): stop css extract from server
1 parent 9fdc871 commit 5c0c652

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
module.exports = {
3+
plugins: [
4+
require('autoprefixer')({ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'IE 10'] })
5+
],
6+
}

webpack/webpack.config.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,7 @@ const GLOBALS = {
1212

1313
const plugins = [
1414
new webpack.NoErrorsPlugin(),
15-
new webpack.DefinePlugin(GLOBALS),
16-
new webpack.LoaderOptionsPlugin({
17-
minimize: !DEBUG,
18-
debug: DEBUG,
19-
options: {
20-
context: paths.contextDir,
21-
postcss: [
22-
require('autoprefixer')({ browsers: ['> 1%', 'last 2 versions', 'Firefox ESR', 'IE 10'] }),
23-
],
24-
},
25-
}),
15+
new webpack.DefinePlugin(GLOBALS)
2616
]
2717

2818
exports.styleLoader = 'style-loader'

webpack/webpack.server.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
const webpack = require('webpack')
44
const merge = require('lodash.merge')
55
const paths = require('../config/paths')
6-
const ExtractTextPlugin = require('extract-text-webpack-plugin')
7-
const { webpackConfig, styleLoader, cssLoader, postcssLoader } = require('./webpack.config.js')
6+
const { webpackConfig, cssLoader, postcssLoader } = require('./webpack.config.js')
87

9-
const extractCSS = new ExtractTextPlugin({ filename: paths.styleSheet, allChunks: true })
8+
const cssLoaderServer = Object.assign({}, cssLoader, { loader: 'css-loader/locals' })
109

1110
//
1211
// Server Config
@@ -23,13 +22,12 @@ const webpackServerConfig = merge({}, webpackConfig, {
2322
module: {
2423
loaders: webpackConfig.module.loaders.concat([{
2524
test: /\.css$/,
26-
loader: extractCSS.extract({ fallbackLoader: styleLoader, loader: [cssLoader, postcssLoader] }),
25+
loaders: [cssLoaderServer, postcssLoader],
2726
exclude: /node_modules/,
2827
}]),
2928
},
3029
plugins: webpackConfig.plugins.concat(
31-
new webpack.DefinePlugin({ __BROWSER__: false }),
32-
extractCSS
30+
new webpack.DefinePlugin({ __BROWSER__: false })
3331
),
3432
node: {
3533
__dirname: false,

0 commit comments

Comments
 (0)