electron-userland / electron-userland/electron-webpack-quick-start

babelcore giving Option passed to a preset which does not accept options.

Open
#33 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
746
Forks
245
PR merge metrics
No merged PRs in 30d

Description

I can provide more details if need be, I've been trying to mess with importing my own webpack config and .babelrc to try to fix this but to no avail, been at it for a few hours for a constant 3 days.

```
ERROR in ./src/renderer/main.js
Module build failed: Error: Options {"modules":false,"targets":{"electron":"1.8.4"}} passed to a preset which does not accept options.
```

```
ERROR in ./src/main/main.js
Module build failed: Error: Options {"modules":false,"targets":{"node":"8.2.1"}} passed to a preset which does not accept options.
```

./main/main.js
```
const { app, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url');

const isDevelopment = process.env.NODE_ENV !== 'production';

// global reference to mainWindow (necessary to prevent window from being garbage collected)
let mainWindow;

function createMainWindow() {
const window = new BrowserWindow();

if (isDevelopment) {
window.webContents.openDevTools();
}

if (isDevelopment) {
window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
} else {
window.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file',
slashes: true
}));
}

window.on('closed', () => {
mainWindow = null;
});

window.webContents.on('devtools-opened', () => {
window.focus();
setImmediate(() => {
window.focus()
});
});

return window;
}

// quit application when all windows are closed
app.on('window-all-closed', () => {
// on macOS it is common for applications to stay open until the user explicitly quits
if (process.platform !== 'darwin') {
app.quit()
}
});

app.on('activate', () => {
// on macOS it is common to re-create a window even after all windows have been closed
if (mainWindow === null) {
mainWindow = createMainWindow();
}
});

// create main BrowserWindow when electron is ready
app.on('ready', () => {
mainWindow = createMainWindow();
});
```

./renderer/main.js
```
const ReactDOM = require('react-dom');
const App = require('../app/App');

ReactDOM.render((

), document.getElementById('app'), (err) => console.log(err));
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported build failure from src/renderer/main.js and src/main/main.js, then inspect the project’s webpack configuration and .babelrc, which the report says were being changed. Compare the preset options in both errors and verify the build succeeds without the reported “preset does not accept options” failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, electron, javascript, webpack
Domain
build-system, desktop-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.