flags: 'g' not working
See original GitHub issueHi
I’ve been trying to get string-replace-loader to work with the ‘g’ flag.
…
loader: 'string-replace-loader', query: { search: 'REST_API', replace: 'test', flags: 'g' }
That doesn’t seem to work out. If I remove the ‘g’ flag and set ‘’ or ‘i’ as flag, it works perfectly. But ‘g’ flag always brings back the following error:
ERROR in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-compiler?{"id":"data-v-84da6350","scoped":false,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/string-replace-loader?{"search":{},"replace":"test","flags":"g"}!./src/components/something/Test.vue
Module build failed: TypeError: Cannot read property 'content' of undefined
at Object.module.exports (/home/inzanez/WebDevel/testapp/node_modules/vue-loader/lib/selector.js:18:27)
@ ./~/vue-style-loader!./~/css-loader?sourceMap!./~/vue-loader/lib/style-compiler?{"id":"data-v-84da6350","scoped":false,"hasInlineConfig":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/string-replace-loader?{"search":{},"replace":"test","flags":"g"}!./src/components/something/Test.vue 4:14-409 13:3-17:5 14:22-417
@ ./src/components/something/Test.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
Any idea what might be wrong here?oO
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Why does a RegExp with global flag give wrong results?
A RegExp object with the g flag keeps track of the lastIndex where a match occurred, so on subsequent matches it will start...
Read more >sed "e" and "g" flags not working together - Unix Stack Exchange
The flags work together in the opposite way to what you're expecting. The documentation of /e is, for the record:.
Read more >Patterns and flags - The Modern JavaScript Tutorial
A regular expression consists of a pattern and optional flags: g , i , m , u , s , y . Without...
Read more >Optimize Options (Using the GNU Compiler Collection (GCC))
Turning on optimization flags makes the compiler attempt to improve the performance and/or code size at the expense of compilation time and possibly...
Read more >Understanding and Using Makefile Flags - Earthly Blog
But let's say that you do not wish to pass the -Wall option; ... CC = gcc CFLAGS = -g # Flag to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
sorry for the delayed reply. this was caused by the bug when options being overwritten, while they should remain immutable. fixed in v2.0.0 released recently
@derekshull @inzanez I have created a new issue with a possible workaround - https://github.com/Va1/string-replace-loader/issues/31