electron-webpack
electron-webpack copied to clipboard
Usage of custom babel config
- Version: 10.1.3
- Target: Windows
I want to use custom babel config (provide options for @babel/preset-react module, which is required for new RC of react). How can I do that with less effort?
I am using all the latest module versions, which are actual tvm. (electron-webpack: 2.8.2, etc)
To add a babel preset, you only have to install it to your project in devDependencies (package.json). It should be detected and used automatically.
To configure babel options, you create a regular babel config file, e.g. babel.config.json and adjust it.
@loopmode I have created a babel.config.js file with next sources:
const isDevelopment = process.env.NODE_ENV !== 'production';
module.exports = {
presets: [
['@babel/preset-env', { useBuiltIns: 'entry', corejs: 3 }],
['@babel/preset-react', { runtime: 'automatic' }],
['@babel/preset-typescript', { allExtensions: true, isTSX: true }],
],
plugins: [
'@reatom/babel-plugin',
isDevelopment && 'react-refresh/babel',
].filter(Boolean),
};
Providing it as it is. No magic. As well if we insert any console.log into this file- it is still not running, while it does with a common webpack setup.
Did you ever get the automatic runtime to work?
Sorry, but what stands for "automatic runtime"? In any case, I have stopped developing electron part of my project also because of this issue
@steveoh Also running into this issue. I have a .babelrc file originally set as the following:
{
"presets": [
"@babel/preset-env",
["@babel/preset-react", {
"runtime": "automatic"
}]
],
"plugins": [
"styled-components"
]
}
…and the automatic runtime is not working.