Skip to content

Commit 519b6e9

Browse files
authored
docs(module): update generator option for asset modules (webpack#7100)
1 parent 15c387a commit 519b6e9

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/content/configuration/module.mdx

+40
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,62 @@ module.exports = {
7272
asset: {
7373
// Generator options for asset modules
7474

75+
// The options for data url generator.
76+
dataUrl: {
77+
// Asset encoding (defaults to "base64")
78+
// type: 'base64' | false
79+
encoding: 'base64',
80+
// Asset mimetype (getting from file extension by default).
81+
// type: string
82+
mimetype: 'image/png',
83+
},
84+
85+
// Emit an output asset from this asset module. This can be set to 'false' to omit emitting e. g. for SSR.
86+
// type: boolean
87+
emit: true,
88+
89+
// Customize filename for this asset module
90+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
91+
filename: 'static/[path][name][ext]',
92+
7593
// Customize publicPath for asset modules, available since webpack 5.28.0
94+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
7695
publicPath: 'https://cdn/assets/',
7796

7897
// Emit the asset in the specified folder relative to 'output.path', available since webpack 5.67.0
98+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
7999
outputPath: 'cdn-assets/',
80100
},
81101
'asset/inline': {
82102
// Generator options for asset/inline modules
103+
104+
// The options for data url generator.
105+
dataUrl: {
106+
// Asset encoding (defaults to "base64")
107+
// type: 'base64' | false
108+
encoding: 'base64',
109+
// Asset mimetype (getting from file extension by default).
110+
// type: string
111+
mimetype: 'image/png',
112+
},
83113
},
84114
'asset/resource': {
85115
// Generator options for asset/resource modules
86116

117+
// Emit an output asset from this asset module. This can be set to 'false' to omit emitting e. g. for SSR.
118+
// type: boolean
119+
emit: true,
120+
121+
// Customize filename for this asset module
122+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
123+
filename: 'static/[path][name][ext]',
124+
87125
// Customize publicPath for asset/resource modules, available since webpack 5.28.0
126+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
88127
publicPath: 'https://cdn/assets/',
89128

90129
// Emit the asset in the specified folder relative to 'output.path', available since webpack 5.67.0
130+
// type: string | ((pathData: PathData, assetInfo?: AssetInfo) => string)
91131
outputPath: 'cdn-assets/',
92132
},
93133
javascript: {

0 commit comments

Comments
 (0)