8000 fix: allow users to run electron-webpack outside a workspace root (#219) · electron-userland/electron-webpack@0a9afdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 0a9afdb

Browse files
stristrdevelar
authored andcommitted
fix: allow users to run electron-webpack outside a workspace root (#219)
* fix: allow users to run electron-webpack outside a workspace root * fix: also ensure we can get source map support working in a workspace.
1 parent acceaf5 commit 0a9afdb

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

packages/electron-webpack/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function build(configFile: string) {
2828
args.push("--config", path.join(__dirname, "..", `webpack.${configFile}.config.js`))
2929

3030
require("yargs")(args.slice(2))
31-
require(path.join(process.cwd(), "node_modules", "webpack-cli", "bin", "cli.js"))
31+
require(require.resolve("webpack-cli"))
3232
}
3333

3434
function runInDevMode() {

packages/electron-webpack/src/dev/WebpackDevServerManager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import { LineFilter, logError, logProcess, logProcessErrorOutput } from "./devUt
99
const debug = require("debug")("electron-webpack")
1010

1111
function runWds(projectDir: string, env: any) {
12-
const isWin = process.platform === "win32"
13-
const webpackDevServerPath = path.join(projectDir, "node_modules", ".bin", "webpack-dev-server" + (isWin ? ".cmd" : ""))
12+
const webpackDevServerPath = require.resolve(path.join("webpack-dev-server", "bin", "webpack-dev-server.js"))
1413
debug(`Start renderer WDS ${webpackDevServerPath} on ${env.ELECTRON_WEBPACK_WDS_PORT} port`)
1514
return run(webpackDevServerPath, ["--color", "--env.autoClean=false", "--config", path.join(__dirname, "../../webpack.renderer.config.js")], {
1615
env,

packages/electron-webpack/src/targets/RendererTarget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class RendererTarget extends BaseRendererTarget {
106106
// not configurable for now, as in the electron-vue
107107
const customTemplateFile = path.join(configurator.projectDir, "src/index.ejs")
108108
const HtmlWebpackPlugin = require("html-webpack-plugin")
109-
const nodeModulePath = configurator.isProduction ? null : path.resolve(configurator.projectDir, "node_modules")
109+
const nodeModulePath = configurator.isProduction ? null : path.resolve(require.resolve('electron'), '..', '..')
110110

111111
configurator.plugins.push(new HtmlWebpackPlugin({
112112
filename: "index.html",

0 commit comments

Comments
 (0)
0