@next-core/build-next-bricks 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/build.js +42 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/build-next-bricks",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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": "f4639c59925a6f007fdf03630bcb9a9b0163cd8b"
49
+ "gitHead": "3e4c6996c85fb0bb14330cd1d128dd8ff690bf5e"
50
50
  }
package/src/build.js CHANGED
@@ -240,52 +240,54 @@ export default async function build(config) {
240
240
  rootMode: "upward",
241
241
  },
242
242
  },
243
- {
244
- test: /\.svg$/i,
245
- issuer(input) {
246
- // The issuer is null (or an empty string) for dynamic import
247
- return !config.svgAsAsset && (!input || /\.[jt]sx?$/.test(input));
248
- },
249
- use: [
250
- {
251
- loader: "babel-loader",
252
- options: {
253
- rootMode: "upward",
243
+ config.svgAsAsset
244
+ ? {
245
+ // Images
246
+ test: /\.(png|svg|jpg|jpeg|gif)$/i,
247
+ type: "asset/resource",
248
+ generator: {
249
+ filename:
250
+ config.imageAssetFilename ?? "images/[hash][ext][query]",
254
251
  },
255
- },
256
- {
257
- loader: "@svgr/webpack",
258
- options: {
259
- babel: false,
260
- icon: true,
261
- svgoConfig: {
262
- plugins: [
263
- {
264
- name: "preset-default",
265
- params: {
266
- overrides: {
267
- // Keep `viewbox`
268
- removeViewBox: false,
269
- convertColors: {
270
- currentColor: true,
252
+ }
253
+ : {
254
+ test: /\.svg$/i,
255
+ issuer(input) {
256
+ // The issuer is null (or an empty string) for dynamic import
257
+ return !input || /\.[jt]sx?$/.test(input);
258
+ },
259
+ use: [
260
+ {
261
+ loader: "babel-loader",
262
+ options: {
263
+ rootMode: "upward",
264
+ },
265
+ },
266
+ {
267
+ loader: "@svgr/webpack",
268
+ options: {
269
+ babel: false,
270
+ icon: true,
271
+ svgoConfig: {
272
+ plugins: [
273
+ {
274
+ name: "preset-default",
275
+ params: {
276
+ overrides: {
277
+ // Keep `viewbox`
278
+ removeViewBox: false,
279
+ convertColors: {
280
+ currentColor: true,
281
+ },
282
+ },
271
283
  },
272
284
  },
273
- },
285
+ ],
274
286
  },
275
- ],
287
+ },
276
288
  },
277
- },
289
+ ],
278
290
  },
279
- ],
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
291
  {
290
292
  // Fonts
291
293
  test: /\.(woff|woff2|eot|ttf|otf)$/i,