File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const paths = require ( '../../config/paths' ) ;
4+
5+ /**
6+ * Checking for loadable install, as there is need to set aliases when this is the case
7+ */
8+ const isLocalComponents = ( ) => {
9+ // Ensure `ssrEnabled` is on
10+ const appPackageJson = require ( paths . appPackageJson ) ;
11+ const isLocalComponentsInstalled =
12+ appPackageJson [ '@skyscanner-internal/local-components' ] || { } ;
13+
14+ return isLocalComponentsInstalled ;
15+ } ;
16+
17+ module . exports = isLocalComponents ;
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'
3434const createEnvironmentHash = require ( './webpack/persistentCache/createEnvironmentHash' ) ;
3535
3636const isSsr = require ( '../backpack-addons/ssr/isSsr' ) ; // #backpack-addons ssr
37+ const isLoadable = require ( '../backpack-addons/ssr/isLocalComponents' ) ; // #backpack-addons ssr
3738
3839// Just for the case that `ssr.js` exists in `src` folder but not in SSR mode
3940const needBuildSsr = ! isSsr ( ) && fs . existsSync ( paths . appSsrJs ) ;
@@ -351,7 +352,9 @@ module.exports = function (webpackEnv) {
351352 . map ( ext => `.${ ext } ` )
352353 . filter ( ext => useTypeScript || ! ext . includes ( 'ts' ) ) ,
353354 alias : {
354- '@loadable/component' : require . resolve ( '@loadable/component' ) ,
355+ ...( isLoadable ( )
356+ ? { '@loadable/component' : require . resolve ( '@loadable/component' ) }
357+ : { } ) ,
355358 // Support React Native Web
356359 // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
357360 'react-native' : 'react-native-web' ,
You can’t perform that action at this time.
0 commit comments