-
Notifications
You must be signed in to change notification settings - Fork 28
Removed preloader from AoT Webpack config #225
Conversation
@@ -19,6 +19,14 @@ function getWebpackConfig(skyPagesConfig) { | |||
let commonConfig = common.getWebpackConfig(skyPagesConfig); | |||
commonConfig.entry = null; | |||
|
|||
// Since the preloader is executed against the file system during an AoT build, | |||
// we need to remove it from the webpack config, otherwise it will get executed twice. | |||
commonConfig.module.rules = commonConfig.module.rules |
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 like the comment. Thanks for that. :-)
Any thoughts on shortening the syntax? Obviously doing the exact same thing, just removed some extraneous parenthesis and removed the const
. I'm pretty impartial on this, just thought the syntax looked a little weird.
commonConfig.module.rules = commonConfig.module.rules
.filter(rule => !/\/sky-processor\//.test(rule.loader));
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.
LOL I had it in this format earlier, but thought setting the boolean made it easier to read.
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'd say using the boolean does make it easier to read. You could make it even easier to read by defining the function into a well-named variable. Simply my two outside-looking-in cents.
found = /\/sky-processor\//.test(rule.loader); | ||
}); | ||
|
||
expect(found).toEqual(false); |
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.
Missing mock.stop(f);
.
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.
Good catch. Added mock.stopAll();
to the afterEach()
.
Codecov Report
@@ Coverage Diff @@
## master #225 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 53 53
Lines 1201 1204 +3
Branches 172 172
=====================================
+ Hits 1201 1204 +3
Continue to review full report at Codecov.
|
Since the preloader is executed on the file system during an AoT build, the loader is run twice: once, during the webpack build, and second, in the
stageAot
method.This duplicate behavior causes plugins to process files twice during AoT, causing things like this (the double-escaped brackets):
https://developer.blackbaud.com/skyux2/learn/reference/configuration