Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Removed preloader from AoT Webpack config #225

Merged
merged 2 commits into from
Jul 14, 2017

Conversation

Blackbaud-SteveBrush
Copy link
Member

@Blackbaud-SteveBrush Blackbaud-SteveBrush commented Jul 14, 2017

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

screen shot 2017-07-13 at 11 28 02 pm

@@ -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

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));

Copy link
Member Author

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.

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing mock.stop(f);.

Copy link
Member Author

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-io
Copy link

codecov-io commented Jul 14, 2017

Codecov Report

Merging #225 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #225   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          53     53           
  Lines        1201   1204    +3     
  Branches      172    172           
=====================================
+ Hits         1201   1204    +3
Flag Coverage Δ
#builder 100% <100%> (ø) ⬆️
#runtime 100% <ø> (ø) ⬆️
#srcapp 100% <ø> (ø) ⬆️
Impacted Files Coverage Δ
config/webpack/build-aot.webpack.config.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a66fb36...8cab5e4. Read the comment docs.

@Blackbaud-SteveBrush Blackbaud-SteveBrush merged commit 06c7366 into master Jul 14, 2017
@Blackbaud-SteveBrush Blackbaud-SteveBrush deleted the fix-aot-preloader branch July 14, 2017 15:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants