Skip to content

PWA-3261 : Multi store setup fix #4456

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

Merged
merged 2 commits into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/venia-concept/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const HTMLWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const fs = require('fs');
const { promisify } = require('util');
const path = require('path');

const {
getMediaURL,
Expand Down Expand Up @@ -72,6 +73,20 @@ module.exports = async env => {
({ store_code }) => store_code === process.env.STORE_VIEW_CODE
);

/**
* Here we check the STORE_VIEW_CODE for multistore setup and generate
* the index.html content to have the store code in script url
* and placed the assets in storeview specific folder inside dist
*/
if (process.env.USE_STORE_CODE_IN_URL && process.env.STORE_VIEW_CODE) {
const storeViewCode = process.env.STORE_VIEW_CODE;
config.output = {
...config.output,
publicPath: `/${storeViewCode}/`,
path: path.resolve(__dirname, 'dist', storeViewCode)
};
}

global.MAGENTO_MEDIA_BACKEND_URL = mediaUrl;
global.LOCALE = storeConfigData.locale.replace('_', '-');
global.AVAILABLE_STORE_VIEWS = availableStores;
Expand Down
Loading