From 9ab13daa6e8e1038d153b597c128dc3f04156807 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 10 Aug 2021 15:42:08 +0200 Subject: [PATCH] fix local compiler --- libs/remix-solidity/src/compiler/compiler-utils.ts | 3 +++ libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/remix-solidity/src/compiler/compiler-utils.ts b/libs/remix-solidity/src/compiler/compiler-utils.ts index 8c7d4f6a28..da3bc487b3 100644 --- a/libs/remix-solidity/src/compiler/compiler-utils.ts +++ b/libs/remix-solidity/src/compiler/compiler-utils.ts @@ -22,6 +22,9 @@ export function urlFromVersion (version) { * checks a compiler whitelist, browser support and OS. */ export function canUseWorker (selectedVersion) { + if (selectedVersion.startsWith('http')) { + return browserSupportWorker() + } const version = semver.coerce(selectedVersion) if (!version) { return browserSupportWorker() diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index 84059151ca..882899a34e 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -138,7 +138,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { // fetching both normal and wasm builds and creating a [version, baseUrl] map const fetchAllVersion = async (callback) => { let selectedVersion, allVersionsWasm, isURL - let allVersions = [{ path: 'builtin', longVersion: 'latest local version - 0.7.4' }] + let allVersions = [{ path: 'builtin', longVersion: 'latest local version - ' + state.defaultVersion }] // fetch normal builds const binRes: any = await promisedMiniXhr(`${baseURLBin}/list.json`) // fetch wasm builds @@ -350,6 +350,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { // Workers cannot load js on "file:"-URLs and we get a // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // resort to non-worker version in that case. + if (selectedVersion === 'builtin') selectedVersion = state.defaultVersion if (selectedVersion !== 'builtin' && canUseWorker(selectedVersion)) { compileTabLogic.compiler.loadVersion(true, url) } else {