File tree 1 file changed +15
-1
lines changed
packages/react-scripts/config
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,21 @@ module.exports = function (webpackEnv) {
140
140
// common function to get style loaders
141
141
const getStyleLoaders = ( cssOptions , preProcessor ) => {
142
142
const loaders = [
143
- isEnvDevelopment && require . resolve ( 'style-loader' ) ,
143
+ isEnvDevelopment && {
144
+ loader : require . resolve ( 'style-loader' ) ,
145
+ options : process . env . REACT_APP_HF_INJECT_STYLES ? {
146
+ injectType : 'singletonStyleTag' ,
147
+ insert : function addToWindowObject ( element ) {
148
+
149
+ const _window = typeof window !== 'undefined' ? window : { }
150
+ if ( ! _window . hfBundleStyles ) {
151
+ _window . hfBundleStyles = [ ]
152
+ }
153
+ element . classList . add ( 'linaria-style' )
154
+ _window . hfBundleStyles . push ( element )
155
+ }
156
+ } : { } ,
157
+ } ,
144
158
isEnvProduction && {
145
159
loader : MiniCssExtractPlugin . loader ,
146
160
// css is located in `static/css`, use '../../' to locate index.html folder
You can’t perform that action at this time.
0 commit comments