Skip to content

Commit 13e9cbf

Browse files
kevinchappellevilebottnawi
authored andcommitted
feat(options): add moduleFilename option (#381)
1 parent b0a0355 commit 13e9cbf

File tree

7 files changed

+98
-58
lines changed

7 files changed

+98
-58
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ module.exports = {
342342
};
343343
```
344344

345+
#### Module Filename Option
346+
347+
With the `moduleFilename` option you can use chunk data to customize the filename. This is particularly useful when dealing with multiple entry points and wanting to get more control out of the filename for a given entry point/chunk. In the example below, we'll use `moduleFilename` to output the generated css into a different directory.
348+
349+
```javascript
350+
const miniCssExtractPlugin = new MiniCssExtractPlugin({
351+
moduleFilename: ({ name }) => `${name.replace('/js/', '/css/')}.css`
352+
})
353+
```
354+
345355
#### Long Term Caching
346356

347357
For long term caching use `filename: "[contenthash].css"`. Optionally add `[name]`.

0 commit comments

Comments
 (0)