Add environment plugin to change from import meta env to process env
This commit is contained in:
parent
65fc11a64f
commit
8b5ba69267
@ -5,7 +5,7 @@
|
||||
"start": "vite --host=0.0.0.0 --port 3000",
|
||||
"build": "run-p type-check build-only",
|
||||
"preview": "vite preview",
|
||||
"test:unit": "jest",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --verbose --watch",
|
||||
"serve": "vue-cli-service serve",
|
||||
"build-only": "vite build",
|
||||
@ -52,6 +52,7 @@
|
||||
"ts-jest": "^27.0.0",
|
||||
"typescript": "~4.7.4",
|
||||
"vite": "^3.1.8",
|
||||
"vite-plugin-environment": "^1.1.3",
|
||||
"vitest": "^0.27.1",
|
||||
"vue-tsc": "^1.0.8",
|
||||
"vue3-jest": "^27.0.0-alpha.1"
|
||||
|
@ -27,8 +27,8 @@ const getProviderUrl = (): string => {
|
||||
const etherStore = useEtherStore();
|
||||
|
||||
const possibleProvidersUrls: { [key: string]: string } = {
|
||||
Ethereum: import.meta.env.VITE_GOERLI_API_URL,
|
||||
Polygon: import.meta.env.VITE_MUMBAI_API_URL,
|
||||
Ethereum: process.env.VITE_GOERLI_API_URL ? process.env.VITE_GOERLI_API_URL : "",
|
||||
Polygon: process.env.VITE_MUMBAI_API_URL ? process.env.VITE_MUMBAI_API_URL : "",
|
||||
};
|
||||
|
||||
return possibleProvidersUrls[etherStore.networkName];
|
||||
|
@ -11,11 +11,11 @@ const getNetworksLiquidity = async (): Promise<void> => {
|
||||
console.log("Loading events");
|
||||
|
||||
const goerliProvider = new ethers.providers.JsonRpcProvider(
|
||||
import.meta.env.VITE_GOERLI_API_URL,
|
||||
process.env.VITE_GOERLI_API_URL,
|
||||
5
|
||||
); // goerli provider
|
||||
const mumbaiProvider = new ethers.providers.JsonRpcProvider(
|
||||
import.meta.env.VITE_MUMBAI_API_URL,
|
||||
process.env.VITE_MUMBAI_API_URL,
|
||||
80001
|
||||
); // mumbai provider
|
||||
|
||||
@ -55,7 +55,7 @@ const getValidDeposits = async (
|
||||
const filterDeposits = p2pContract.filters.DepositAdded(null);
|
||||
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
|
||||
|
||||
p2pContract = getContract(); // get metamask provider contract
|
||||
if(!contract) p2pContract = getContract(); // get metamask provider contract
|
||||
|
||||
const depositList = await Promise.all(
|
||||
eventsDeposits.map(async (deposit) => {
|
||||
|
@ -5,7 +5,7 @@ import ManageBidsView from "../views/ManageBidsView.vue";
|
||||
import SellerView from "@/views/SellerView.vue";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
history: createWebHistory(process.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
|
@ -8,7 +8,7 @@ const defaultConfig = {
|
||||
|
||||
const api = axios.create({
|
||||
...defaultConfig,
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
baseURL: process.env.VITE_API_URL,
|
||||
});
|
||||
|
||||
export default api;
|
||||
|
@ -3,10 +3,11 @@ import { fileURLToPath, URL } from "node:url";
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import EnvironmentPlugin from 'vite-plugin-environment';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue(), vueJsx()],
|
||||
plugins: [vue(), vueJsx(), EnvironmentPlugin('all')],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
|
@ -5924,6 +5924,11 @@ vite-node@0.27.1:
|
||||
source-map-support "^0.5.21"
|
||||
vite "^3.0.0 || ^4.0.0"
|
||||
|
||||
vite-plugin-environment@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/vite-plugin-environment/-/vite-plugin-environment-1.1.3.tgz#d01a04abb2f69730a4866c9c9db51d3dab74645b"
|
||||
integrity sha512-9LBhB0lx+2lXVBEWxFZC+WO7PKEyE/ykJ7EPWCq95NEcCpblxamTbs5Dm3DLBGzwODpJMEnzQywJU8fw6XGGGA==
|
||||
|
||||
"vite@^3.0.0 || ^4.0.0", vite@^3.1.8:
|
||||
version "3.1.8"
|
||||
resolved "https://registry.npmjs.org/vite/-/vite-3.1.8.tgz"
|
||||
|
Loading…
x
Reference in New Issue
Block a user