@next-core/build-next-bricks 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/build.js +17 -1
package/index.d.ts
CHANGED
|
@@ -66,6 +66,8 @@ export interface BuildNextBricksConfig {
|
|
|
66
66
|
mode?: "development" | "production";
|
|
67
67
|
entry?: Record<string, string>;
|
|
68
68
|
extractCss?: boolean;
|
|
69
|
+
svgAsAsset?: boolean;
|
|
70
|
+
imageAssetFilename?: string | ((pathData: any, assetInfo: any) => string);
|
|
69
71
|
plugins?: Configuration["plugins"];
|
|
70
72
|
moduleRules?: RuleSetRule[];
|
|
71
73
|
exposes?: ConstructorParameters<typeof container.ModuleFederationPlugin>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/build-next-bricks",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Build next bricks",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/build-next-bricks",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"typescript": "^5.0.2",
|
|
47
47
|
"webpack": "^5.76.2"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "286f6b5ed8f4c5dc42e6c361b994d456b1613205"
|
|
50
50
|
}
|
package/src/build.js
CHANGED
|
@@ -244,7 +244,7 @@ export default async function build(config) {
|
|
|
244
244
|
test: /\.svg$/i,
|
|
245
245
|
issuer(input) {
|
|
246
246
|
// The issuer is null (or an empty string) for dynamic import
|
|
247
|
-
return !input || /\.[jt]sx?$/.test(input);
|
|
247
|
+
return !config.svgAsAsset && (!input || /\.[jt]sx?$/.test(input));
|
|
248
248
|
},
|
|
249
249
|
use: [
|
|
250
250
|
{
|
|
@@ -278,6 +278,22 @@ export default async function build(config) {
|
|
|
278
278
|
},
|
|
279
279
|
],
|
|
280
280
|
},
|
|
281
|
+
{
|
|
282
|
+
// Images
|
|
283
|
+
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
284
|
+
type: "asset/resource",
|
|
285
|
+
generator: {
|
|
286
|
+
filename: config.imageAssetFilename ?? "images/[hash][ext][query]",
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
// Fonts
|
|
291
|
+
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
292
|
+
type: "asset/resource",
|
|
293
|
+
generator: {
|
|
294
|
+
filename: "fonts/[hash][ext][query]",
|
|
295
|
+
},
|
|
296
|
+
},
|
|
281
297
|
...(config.moduleRules || []),
|
|
282
298
|
],
|
|
283
299
|
},
|