Skip to content

Commit

Permalink
Treat .css and .sass/.scss as side effectful
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Oct 1, 2018
1 parent aa57262 commit b8c3e84
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ module.exports = {
importLoaders: 1,
sourceMap: shouldUseSourceMap,
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules (https://github.com/css-modules/css-modules)
// using the extension .module.css
Expand Down Expand Up @@ -397,6 +402,11 @@ module.exports = {
},
'sass-loader'
),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
// Remove this when webpack adds a warning or an error for this.
// See https://github.com/webpack/webpack/issues/6571
sideEffects: true,
},
// Adds support for CSS Modules, but using SASS
// using the extension .module.scss or .module.sass
Expand Down

1 comment on commit b8c3e84

@simonjoom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks this helped to support treeshaking with bad side effect on css. :)

Please sign in to comment.