@mainset/bundler-webpack 0.4.0 → 0.4.1

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.
@@ -14,14 +14,22 @@ const BABEL_LOADER__RULE__WEBPACK_CONFIG_FRAGMENT = createBabelLoaderRule(BABEL_
14
14
  const SSR_SERVER_BABEL_LOADER__RULE__WEBPACK_CONFIG_FRAGMENT = createBabelLoaderRule(BABEL_CONFIG__NODE);
15
15
  const IMAGES__RULE__WEBPACK_CONFIG_FRAGMENTS = [
16
16
  {
17
- test: /\.(svg|png)$/,
17
+ test: /\.(avif|gif|ico|jpe?g|png|svg|webp)$/i,
18
18
  exclude: /\.source\.svg$/,
19
19
  type: 'asset/resource',
20
20
  generator: {
21
- filename: '[name].[contenthash:8].[ext]',
21
+ // NOTE: written to `<output.path>/assets/images/`, loaded from
22
+ // `<output.publicPath>assets/images/`. `[ext]` already includes the dot.
23
+ filename: 'assets/images/[name].[contenthash:8][ext]',
24
+ // NOTE: replaced by the folder in {filename} above — the only option
25
+ // webpack applies to both the file and its URL. {outputPath} never
26
+ // reaches the URL, and a {publicPath} here REPLACES {output.publicPath}:
27
+ // a relative one resolves against the page's URL, which breaks on nested
28
+ // routes (/en/docninja → /en/assets/images/…) and for Module Federation
29
+ // remotes, whose images live on their own origin (CDN), not the host's.
22
30
  // NOTE: the following paths are relative to the webpack output path (e.g. dist/)
23
- outputPath: 'assets/images/',
24
- publicPath: 'assets/images/',
31
+ // outputPath: 'assets/images/',
32
+ // publicPath: 'assets/images/',
25
33
  },
26
34
  },
27
35
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mainset/bundler-webpack",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Bundler for web apps",
5
5
  "homepage": "https://github.com/mainset/dev-stack-fe/tree/main/packages/bundler-webpack",
6
6
  "bugs": {
@@ -55,8 +55,8 @@
55
55
  "webpack-merge": "^6.0.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@mainset/dev-stack-fe": "^0.2.3",
59
- "@mainset/cli": "^0.7.4"
58
+ "@mainset/cli": "^0.7.4",
59
+ "@mainset/dev-stack-fe": "^0.2.3"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "@mainset/cli": ">=0.5.0 <1.0.0",
@@ -37,6 +37,26 @@ declare module '*.scss';
37
37
  declare module '*.sass';
38
38
 
39
39
  // NOTE: {asset/resource} — emits the file and exports its public URL
40
+ declare module '*.avif' {
41
+ const src: string;
42
+ export default src;
43
+ }
44
+ declare module '*.gif' {
45
+ const src: string;
46
+ export default src;
47
+ }
48
+ declare module '*.ico' {
49
+ const src: string;
50
+ export default src;
51
+ }
52
+ declare module '*.jpeg' {
53
+ const src: string;
54
+ export default src;
55
+ }
56
+ declare module '*.jpg' {
57
+ const src: string;
58
+ export default src;
59
+ }
40
60
  declare module '*.png' {
41
61
  const src: string;
42
62
  export default src;
@@ -45,3 +65,7 @@ declare module '*.svg' {
45
65
  const src: string;
46
66
  export default src;
47
67
  }
68
+ declare module '*.webp' {
69
+ const src: string;
70
+ export default src;
71
+ }