Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable hard-coded sourcemap support via environment variable #395

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat: disable hard-coded sourcemap support via environment variable #395

wants to merge 2 commits into from

Conversation

jimmed
Copy link

@jimmed jimmed commented Aug 7, 2020

In reference to #285, this allows users to disable the hard-coded insertion of a script tag that is inserted into the generated root HTML page, by passing setting the environment variable ELECTRON_WEBPACK_DISABLE_SOURCE_MAP_SUPPORT to any non-empty value.

In reference to [#285][1], this allows users to disable the hard-coded
insertion of a script tag that is inserted into the generated root HTML page,
by passing an environment variable,
`ELECTRON_WEBPACK_DISABLE_SOURCE_MAP_SUPPORT`.

[1]: #285
@Letrab
Copy link

Letrab commented Sep 18, 2020

Also prevent .map file generation here in this case: https://github.com/electron-userland/electron-webpack/blob/master/packages/electron-webpack/src/main.ts#L171 ?

(set devtool to undefined (or false))

@boris47
Copy link

boris47 commented Oct 17, 2020

It would be nice if also the lines about 'nodeModulePath' are allowed to be disabled with a variable like your.
In my configuration with nodeIntegration disabled, contextIsolation and sandbox enabled are, these lines are the only bad things. My very badly solution is to remove both line #1 and #2 in postinstall script.
In this way the 'Uncaught ReferenceError: require is not defined at (index):8' is fixed.

@geeofree
Copy link

geeofree commented Oct 22, 2020

Seconding @boris47 . I think the hardcoded require calls on the generated html files should be removed, or at least be optionally added — it forces people to use unsafe nodeIntegration: true option on the browser window.

@jimmed
Copy link
Author

jimmed commented Oct 22, 2020

Sorry folks, I don't have any time to continue work on this PR; the suggestions are all valuable though, and I'm glad they're captured here. If anybody is keen to see this merged, feel free to fork and extend.

@j3g
Copy link

j3g commented Jul 7, 2021

@boris47 @geeofree when I remove the lines of code ... I get an error about the global variable not defined. I tried to modify the require() to an ES6 import command. Can you share more details of how you got around this issue?

I am using electron-webpack (with webpack 5.x) and I also have "nodeIntegration disabled, contextIsolation and sandbox enabled" ... i'm looking for the tightest security

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

Successfully merging this pull request may close these issues.

6 participants