Modify Webpack to use graceful-fs to avoid common fs issues.
Webpack by default uses graceful-fs for certain filesystem functions. However in some cases, such as writing output for hundreds of iLib asset files, the output filesystem may need to be augmented to force usage of graceful-fs alternative functions.
npm install --save-dev @enact/dev-utils
In your webpack.config.js:
const {GracefulFsPlugin} = require('@enact/dev-utils');
// ...
plugins: [
new GracefulFsPlugin();
],You can pass optional configuration settings to GracefulFsPlugin. Usually only writeFile is needed (and is enabled by default with this plugin), but other functions are exposed as well.
Allowed values are as follows:
writeFile: Use the graceful-fswriteFilefunction in the webpack Node output filesystem. Defaults totrue.mkdir: Use the graceful-fsmkdirfunction in the webpack Node output filesystem. Defaults tofalse.unlink: Use the graceful-fsunlinkfunction in the webpack Node output filesystem. Defaults tofalse.rmdir: Use the graceful-fsrmdirfunction in the webpack Node output filesystem. Defaults tofalse.
Here's an example webpack config illustrating how to use these options:
{
entry: 'index.js',
output: {
path: 'dist',
filename: 'bundle.js'
},
plugins: [
new GracefulFsPlugin({
unlink: true,
rmdir: true
})
]
}