I am attempting to create a specific output format for my locale files in the form of _locales/[locale_shortcut]/[file].json
To achieve this, I am utilizing the file-loader plugin within webpack. While the documentation mentions the use of a function within the outputPath option, there is no clear explanation provided on its structure or expected return value. I assumed it should return a string similar to what you would directly input into outputPath...
The code snippet below is intended for files named like [locale_shortcut].locale.json:
{
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: (t: any) => {
return "_locales/" + t.replace(".locale.json") + "/";
},
},
},
Upon running this code, I encounter an error:
EISDIR: illegal operation on a directory, open '/Users/[user]/projects/[project]/dist/_locales/en/'
List of dependencies used:
- file-loader 2.0.0
- webpack 4.27.1
- typescript 3.1.1