Skip to content

Commit 985979b

Browse files
committed
Make injecting styles more dynamic
1 parent b76e800 commit 985979b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,12 @@ module.exports = function (webpackEnv) {
142142
const loaders = [
143143
isEnvDevelopment && {
144144
loader: require.resolve('style-loader'),
145-
options: process.env.REACT_APP_HF_INJECT_STYLES ? {
145+
options: process.env.REACT_APP_INJECT_STYLES ? {
146146
injectType: 'singletonStyleTag',
147147
insert: function addToWindowObject(element) {
148148

149149
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)
150+
_window[process.env.REACT_APP_INJECT_STYLES] = element
155151
}
156152
} : {},
157153
},
@@ -232,6 +228,9 @@ module.exports = function (webpackEnv) {
232228
}
233229

234230
return {
231+
snapshot: {
232+
unmanagedPaths: ['/Users/rtbrown560/Code/hf-inj-react/node_modules/@fs/'],
233+
},
235234
target: ['browserslist'],
236235
// Webpack noise constrained to errors and warnings
237236
stats: 'errors-warnings',

0 commit comments

Comments
 (0)