How to know that ramdisk is being used?
So for my Electron project I'm also using the filesystem cache with the following:
cache: {
type: 'filesystem',
},
I don't have output/path set in my webpack rules. During the build step I see the following:
⠋ Compiling Renderer Template⬡ webpack-plugin-ramdisk: Build being written to /Volumes/wpr/myname/myproject
✔ Compiling Renderer Template
✔ Preparing to Package Application for arch: x64
But ramdisk didn't seem to make any different at all to build times.
Is there a way for me to verify it's being used? I do see the Volume mounted, but I don't know if it's being read.
You'd have to watch I/o on the virtual disk. If you're not already using memory-fs, and you're outputting to a regular file location on a physical disk, and using ramdisk no longer outputs to that physical disk, you could be fairly certain the virtual disk is being used. It's rare but there are some situations where it may not make much of a difference.
The normal filesystem cache writes to node_modules/.cache/webpack. Tried deleting everything there and building with ramdisk included, and seems that still gets filled up fully again.
Using the filesystem cache pretty much cuts my build time in half, so I'm pretty confident ramdisk would make a larger impact. But from what you're saying doesn't sound conclusive it's being used at all.
Tried also only including ramdisk and no filesystem cache, and that didn't seem to really do anything to build times (maybe 5s off?).
Earlier was only including ramdisk into my webpack.renderer.config, but including also into webpack.main.config get the following error:
✔ Checking your system
⠙ Preparing to Package Application for arch: x64⠋ Compiling Main Process Code⬡ webpack-plugin-ramdisk: Build being written [...]
✔ Compiling Main Process Code
⠋ Compiling Renderer Template⬡ webpack-plugin-ramdisk: Build being written [...]
✔ Compiling Renderer Template
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
⠋ Packaging Application
An unhandled rejection has occurred inside Forge:
Error: The main entry point to your app was not found. Make sure "/[...]/webpack/main" exists and does not get ignored by your ignore option
Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.
and seems that still gets filled up fully again
Sounds like you have a setting that's overriding the ramdisk plugin's behavior.
Any idea what that could be? If it's within the webpack config versus something inside of package.json. Have the following inside of webpack,
plugins: [
new WebpackPluginRamdisk(),
new CopyPlugin({
patterns: [
{
from: path.join('src', 'loading'),
to: 'loading',
},
],
}),
new webpack.DefinePlugin({
'process.env.IS_DEVELOPMENT': JSON.stringify(process.env.IS_DEVELOPMENT),
}),
],
Which doesn't seem like it'd be overriding behavior. So my guess would be it's something within Electron itself.