Skip to content

Commit 823ebe2

Browse files
committed
feat: improve regex
1 parent c2e3e19 commit 823ebe2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lib/codegen/styleInjection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { attrsToQuery } = require('./utils')
22
const hotReloadAPIPath = JSON.stringify(require.resolve('vue-hot-reload-api'))
3-
const allWhitespaceRE = /^\s+$/
3+
const nonWhitespaceRE = /\S+/
44

55
module.exports = function genStyleInjectionCode (
66
loaderContext,
@@ -71,7 +71,7 @@ module.exports = function genStyleInjectionCode (
7171
}
7272

7373
// filter out empty styles (with no `src` specified or only contains whitespaces)
74-
styles = styles.filter(style => style.src || !allWhitespaceRE.test(style.content))
74+
styles = styles.filter(style => style.src || nonWhitespaceRE.test(style.content))
7575
// explicit injection is needed in SSR (for critical CSS collection)
7676
// or in Shadow Mode (for injection into shadow root)
7777
// In these modes, vue-style-loader exports objects with the __inject__

0 commit comments

Comments
 (0)