Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Add method to bypass the compilers completely #199

Merged
merged 2 commits into from
Apr 6, 2017

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Mar 5, 2017

Fixes electron/forge#153

The reason I added this instead of a new bypass:// protocol or similar is because (on windows at least) the file path passed to the Electron protocol handler only works as expected on file:// not on any other URI's, it just get's completely messed up. This would seem to achieve what the above issue needs to so I think it's good enough for now 👍.

Users can now just do this.

import { addBypassChecker } from 'electron-compile';

addBypassChecker((filePath) => {
  return /\.mp4/.test(filePath);
});

Or something similar, the more common use case might be a function like this (untested).

import { app } from 'electron';
import { addBypassChecker } from 'electron-compile';

addBypassChecker((filePath) => {
  return filePath.indexOf(app.getAppPath()) === -1;
});

Which would theoretically bypass electron-compile for all files not in the current app.

@anaisbetts
Copy link
Contributor

This is still on my list

@anaisbetts
Copy link
Contributor

I'm gonna merge this for now so that it doesn't get paved when I convert electron-compile to TypeScript

@onassar
Copy link

onassar commented Apr 27, 2018

Where would one include this? I'm including it in one of my scripts, but I assume it needs to be located in a forge or compile script somewhere?

@damienallen
Copy link

Where would one include this? I'm including it in one of my scripts, but I assume it needs to be located in a forge or compile script somewhere?

I put in in index.ts but I don't think it matters so much. As far as I can tell it just has to be executed before any files needing the bypass are loaded.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to play mp4 files stored in local file system using<video> tag
4 participants