Skip to content

Commit

Permalink
Use explicit function param
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalbennani committed Sep 28, 2017
1 parent eb68ebd commit 115e0d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
38 changes: 18 additions & 20 deletions packages/react-scripts/config/botifyConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const postCssOptions = {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
};

const getSCSSLoaderConfig = isDev => {
const loaders = [
{
Expand All @@ -29,7 +11,23 @@ const getSCSSLoaderConfig = isDev => {
},
{
loader: require.resolve('postcss-loader'),
options: postCssOptions,
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
require.resolve('sass-loader'),
];
Expand All @@ -50,7 +48,7 @@ const getSCSSLoaderConfig = isDev => {
};
};

module.exports = (isDev = true) => ({
module.exports = ({ isDev = true } = {}) => ({
babelPlugins: [require.resolve('babel-plugin-transform-decorators-legacy')],
webpackLoaders: [getSCSSLoaderConfig(isDev)],
});
2 changes: 1 addition & 1 deletion packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');
const getBotifyConfig = require('./botifyConfig');
const botifyConfig = getBotifyConfig(false);
const botifyConfig = getBotifyConfig({ isDev: false });

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
Expand Down

0 comments on commit 115e0d0

Please sign in to comment.