We have some errore with fs not found : Error: Cannot resolve module 'fs'
and i know we can use the node option in webpack.config with fs as 'empty' but in this way the error is now " fs.readFileSync is not a function".
let ExtractTextPlugin = require('extract-text-webpack-plugin');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './src/js/main.js',
output : {
path: 'dist/',
filename: '[name].bundle.js'
devtool: 'source-map',
module:{
loaders:[
{test: /\.html$/, exclude: 'node_modules', loader: 'html-loader'},
{test: /\.scss$/, exclude: 'node_modules', loader: ExtractTextPlugin.extract(['css', 'sass'])},
{test: /\.js$/, exclude: 'node_modules', loader: 'babel-loader'}
plugins:[
new ExtractTextPlugin('app.bundle.css'),
new HtmlWebpackPlugin({ template: './src/index.html'}),
new CopyWebpackPlugin([{from: './src/electron_entry.js'}]),
the electron entry :
const {app, BrowserWindow} = require('electron')
let win
function createWindow () {
win = new BrowserWindow({width: 800, height: 600})
win.loadURL(`file://${__dirname}/index.html`)
win.webContents.openDevTools()
win.on('closed', () => {
win = null
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
app.on('activate', () => {
if (win === null) {
createWindow()
And some js for working :
let ipcMain = require('electron')
console.log("hello le monde")
let test = (id) => {
return `Ok pour le retour ${id}`
ipcMain.send('ok pour l\'envoi'); // <---- this use create the error
console.log(test(test me'))
Thank's a lot for your help
Cacivy, aylanismello, kittaakos, isonet, HeroProtagonist, mariusvoian, Spring3, wandererparsifal, jonathanargentiero, kwasi, and 65 more reacted with thumbs up emoji
hanxue, Hissvard, jcs224, DevCubeHD, azertypow, diegoddox, EstebanBorai, janmarkuslanger, sgarridodorma, zetaraku, and huunghia1023 reacted with hooray emoji
chalkpe, PaulStepanov, cristovao-trevisan, AlexxNica, lai32290, Hissvard, oulrich1, jcs224, DevCubeHD, azertypow, and 7 more reacted with heart emoji
All reactions
altair21, igaozp, flockonus, alexfqc, otiai10, AlexxNica, oulrich1, Plochie, awgv, deepakyadav, and 3 more reacted with thumbs up emoji
CodeAmend and oulrich1 reacted with confused emoji
All reactions
I'm trying to get Monaco to work in electron and even though I set the target to electron in webpack 4, I still get an error for a wrong import of fs inside the typescript language service. Could this be a Babel issue or does setting the target to electron only fix fs inside electron? Thanks for you help!