From deb94f6f4aa414e9dad32c20e8dca38bc1c142cf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 28 Feb 2017 17:17:02 +0100 Subject: [PATCH] Fix dev mode --- static/index.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/static/index.js b/static/index.js index 2d660c844..c79055200 100644 --- a/static/index.js +++ b/static/index.js @@ -8,7 +8,6 @@ let blobStore = null let devMode = false let useSnapshot = false - let requireFunction = null window.onload = function () { try { @@ -24,7 +23,6 @@ setupAtomHome() devMode = getWindowLoadSettings().devMode || !getWindowLoadSettings().resourcePath.startsWith(process.resourcesPath + path.sep) useSnapshot = !devMode && typeof snapshotResult !== 'undefined' - requireFunction = useSnapshot ? snapshotResult.customRequire : require if (devMode) { const metadata = require('../package.json') @@ -51,16 +49,6 @@ snapshotResult.entryPointDirPath = __dirname } - // const FileSystemBlobStore = requireFunction('../src/file-system-blob-store.js') - // blobStore = FileSystemBlobStore.load( - // path.join(process.env.ATOM_HOME, 'blob-store/') - // ) - - // const NativeCompileCache = requireFunction('../src/native-compile-cache.js') - // NativeCompileCache.setCacheStore(blobStore) - // NativeCompileCache.setV8Version(process.versions.v8) - // NativeCompileCache.install() - if (getWindowLoadSettings().profileStartup) { profileStartup(Date.now() - startTime) } else { @@ -88,21 +76,21 @@ } function setupWindow () { - const CompileCache = requireFunction('../src/compile-cache.js') + const CompileCache = useSnapshot ? snapshotResult.customRequire('../src/compile-cache.js') : require('../src/compile-cache') CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME) CompileCache.install(require) - const ModuleCache = requireFunction('../src/module-cache.js') + const ModuleCache = useSnapshot ? snapshotResult.customRequire('../src/module-cache.js') : require('../src/module-cache') ModuleCache.register(getWindowLoadSettings()) - const startCrashReporter = requireFunction('../src/crash-reporter-start.js') + const startCrashReporter = useSnapshot ? snapshotResult.customRequire('../src/crash-reporter-start.js') : require('../src/crash-reporter-start') startCrashReporter({_version: getWindowLoadSettings().appVersion}) - const CSON = requireFunction(useSnapshot ? '../node_modules/season/lib/cson.js' : 'season') + const CSON = useSnapshot ? snapshotResult.customRequire('../node_modules/season/lib/cson.js') : require('season') CSON.setCacheDir(path.join(CompileCache.getCacheDirectory(), 'cson')) const initScriptPath = path.relative(entryPointDirPath, getWindowLoadSettings().windowInitializationScript) - const initialize = requireFunction(initScriptPath) + const initialize = useSnapshot ? snapshotResult.customRequire(initScriptPath) : require(initScriptPath) return initialize({blobStore: blobStore}).then(function () { electron.ipcRenderer.send('window-command', 'window:loaded') })