Skip to content

Commit

Permalink
fix(*): fix postcss webpack server config
Browse files Browse the repository at this point in the history
  • Loading branch information
Федосимов Алексей Александрович authored and Федосимов Алексей Александрович committed Sep 12, 2019
1 parent 5443a6f commit bbfcd53
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion configs/webpack.server.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM
const getLocalIdentPattern = require('./util/css-modules-local-ident');
const configs = require('./app-configs');
const babelConf = require('./babel-server');
const postcssConf = require('./postcss');
const applyOverrides = require('./util/apply-overrides');
const assetsIgnoreBanner = fs.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');

Expand Down Expand Up @@ -127,7 +128,16 @@ const config = {
modules: true,
localIdentName: getLocalIdentPattern({ isProduction: false })
},
}
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => postcssConf,
},
},
],
},
// "file" loader makes sure those assets get served by WebpackDevServer.
Expand Down
12 changes: 11 additions & 1 deletion configs/webpack.server.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const getLocalIdentPattern = require('./util/css-modules-local-ident');
const configs = require('./app-configs');
const babelConf = require('./babel-server');
const postcssConf = require('./postcss');
const applyOverrides = require('./util/apply-overrides');
const assetsIgnoreBanner = fs.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');

Expand Down Expand Up @@ -115,7 +116,16 @@ module.exports = applyOverrides(['webpack', 'webpackServer', 'webpackProd', 'web
modules: true,
localIdentName: getLocalIdentPattern({ isProduction: true })
},
}
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => postcssConf,
},
},
],
},
// "file" loader makes sure those assets get served by WebpackDevServer.
Expand Down

0 comments on commit bbfcd53

Please sign in to comment.