fix local compiler

pull/1469/head
yann300 3 years ago
parent f7c6ac368e
commit 9ab13daa6e
  1. 3
      libs/remix-solidity/src/compiler/compiler-utils.ts
  2. 3
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx

@ -22,6 +22,9 @@ export function urlFromVersion (version) {
* checks a compiler whitelist, browser support and OS. * checks a compiler whitelist, browser support and OS.
*/ */
export function canUseWorker (selectedVersion) { export function canUseWorker (selectedVersion) {
if (selectedVersion.startsWith('http')) {
return browserSupportWorker()
}
const version = semver.coerce(selectedVersion) const version = semver.coerce(selectedVersion)
if (!version) { if (!version) {
return browserSupportWorker() return browserSupportWorker()

@ -138,7 +138,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
// fetching both normal and wasm builds and creating a [version, baseUrl] map // fetching both normal and wasm builds and creating a [version, baseUrl] map
const fetchAllVersion = async (callback) => { const fetchAllVersion = async (callback) => {
let selectedVersion, allVersionsWasm, isURL 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 // fetch normal builds
const binRes: any = await promisedMiniXhr(`${baseURLBin}/list.json`) const binRes: any = await promisedMiniXhr(`${baseURLBin}/list.json`)
// fetch wasm builds // fetch wasm builds
@ -350,6 +350,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
// Workers cannot load js on "file:"-URLs and we get a // Workers cannot load js on "file:"-URLs and we get a
// "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium, // "Uncaught RangeError: Maximum call stack size exceeded" error on Chromium,
// resort to non-worker version in that case. // resort to non-worker version in that case.
if (selectedVersion === 'builtin') selectedVersion = state.defaultVersion
if (selectedVersion !== 'builtin' && canUseWorker(selectedVersion)) { if (selectedVersion !== 'builtin' && canUseWorker(selectedVersion)) {
compileTabLogic.compiler.loadVersion(true, url) compileTabLogic.compiler.loadVersion(true, url)
} else { } else {

Loading…
Cancel
Save