-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support serialization of RegExp #102
fix: support serialization of RegExp #102
Conversation
Codecov Report
@@ Coverage Diff @@
## master #102 +/- ##
==========================================
+ Coverage 20.30% 21.84% +1.53%
==========================================
Files 7 8 +1
Lines 458 467 +9
Branches 86 89 +3
==========================================
+ Hits 93 102 +9
Misses 322 322
Partials 43 43
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide case where we need it?
@alexander-akait We noticed our tests started breaking when thread-loader got upgraded. This is because sass-loader uses regexes (in |
@@ -7,6 +7,7 @@ import asyncMapSeries from 'neo-async/mapSeries'; | |||
|
|||
import readBuffer from './readBuffer'; | |||
import WorkerError from './WorkerError'; | |||
import { replacer, reviver } from './serializer'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than using a custom serializer, you should use the Node serialization APIs:
https://nodejs.org/api/v8.html#v8_serialization_api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using a more familiar and portable API as long as it solves the same problem.
@alexander-akait what do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v8 seriliazer doesn't support many feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexander-akait Just run into this PR due to function option, I'm just curious what feature is missing then JSON
?
I finally figured out how to reproduce it in tests, so I updated the existing test case to reflect that. |
@alexander-akait what should I do next towards merging this PR? |
@qnighy Please ping me on these weekend (busy now 😞 ) |
@alexander-akait Could you review this PR this weekend? Thanks in advance! |
Hope in future we move multi threading into webpack core |
Update to the latest thread-loader, mainly so we can [use RegExps](webpack-contrib/thread-loader#102) in plugin options (which was release in v3.0.2).
This PR contains a:
Motivation / Use-Case
Part of #75.
enhanced-resolve v4.2.0 introduced the
restrictions
option. Webpack >= 4.44.0 requires these versions of enhanced-resolve.sass-loader v9.0.0 started to use the
restrictions
option (#851, #856). This is used when thewebpackImporter
option is true (the default value) and a non-trivial@import
is found in the sass file.thread-loader intercepts the
getResolve()()
call and sends the request across the process boundary. It currently uses the vanillaJSON.stringify
/JSON.parse
(de)serializer, so the{ restrictions: [/\.((sa|sc|c)ss)$/i] }
option is turned into{ restrictions: [{}] }
. enhanced-resolve tries to call.test
on the given object and the call fails.Breaking Changes
Additional Info