Skip to content
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

Changing config.base on the fly #4240

Closed
4 tasks done
juvirez opened this issue Jul 13, 2021 · 2 comments
Closed
4 tasks done

Changing config.base on the fly #4240

juvirez opened this issue Jul 13, 2021 · 2 comments

Comments

@juvirez
Copy link

juvirez commented Jul 13, 2021

Clear and concise description of the problem

We have a Vue project, which is embedded to an external page with its own backend. That is why we are using full URL in config.base (ex: config.base = 'https://example.com/static/').

The problem is that we use different environments on different domains (prod, stage servers with different domains) for our application built with Vite.

This means that the application built with the base = 'https://example.com/static' cannot be launched on the sandbox1.example.com domain.

Suggested solution

Before migrating the project to vite, we used vue-cli where webpack provided the ability to set baseUrl on the fly with the js global variable __webpack_public_path__. And for each environment, this variable was initialized in its own way.

Is it possible to make a similar variable that all imports in the application would depend on?

Alternative

No response

Additional context

No response

Validations

@bluwy
Copy link
Member

bluwy commented Mar 12, 2022

Does base: "./" solve this too? https://vitejs.dev/config/#base

@bluwy
Copy link
Member

bluwy commented Mar 18, 2022

Duplicate of #3522

@bluwy bluwy marked this as a duplicate of #3522 Mar 18, 2022
@bluwy bluwy closed this as completed Mar 18, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants