File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
33const webpack = require ( 'webpack' ) ;
44const fs = require ( 'fs' ) ;
55const { promisify } = require ( 'util' ) ;
6+ const path = require ( 'path' ) ;
67
78const {
89 getMediaURL,
@@ -72,6 +73,20 @@ module.exports = async env => {
7273 ( { store_code } ) => store_code === process . env . STORE_VIEW_CODE
7374 ) ;
7475
76+ /**
77+ * Here we check the STORE_VIEW_CODE for multistore setup and generate
78+ * the index.html content to have the store code in script url
79+ * and placed the assets in storeview specific folder inside dist
80+ */
81+ if ( process . env . USE_STORE_CODE_IN_URL && process . env . STORE_VIEW_CODE ) {
82+ const storeViewCode = process . env . STORE_VIEW_CODE ;
83+ config . output = {
84+ ...config . output ,
85+ publicPath : `/${ storeViewCode } /` ,
86+ path : path . resolve ( __dirname , 'dist' , storeViewCode )
87+ } ;
88+ }
89+
7590 global . MAGENTO_MEDIA_BACKEND_URL = mediaUrl ;
7691 global . LOCALE = storeConfigData . locale . replace ( '_' , '-' ) ;
7792 global . AVAILABLE_STORE_VIEWS = availableStores ;
You can’t perform that action at this time.
0 commit comments