Browse Source

Strip SUI icons from bundle (unused) (#3218)

Jaco Greeff 4 years ago
parent
commit
5f44624233
4 changed files with 27 additions and 16 deletions
  1. 1 0
      packages/apps/package.json
  2. 0 14
      packages/apps/public/next/index.html
  3. 13 2
      packages/apps/webpack.base.config.js
  4. 13 0
      yarn.lock

+ 1 - 0
packages/apps/package.json

@@ -31,6 +31,7 @@
     "html-webpack-plugin": "^4.3.0",
     "markdown-loader": "^5.1.0",
     "mini-css-extract-plugin": "^0.9.0",
+    "null-loader": "^4.0.0",
     "style-loader": "^1.2.1",
     "thread-loader": "^2.1.3",
     "url-loader": "^4.1.0",

+ 0 - 14
packages/apps/public/next/index.html

@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en-US">
-  <head>
-    <meta charset="UTF-8">
-    <meta http-equiv="refresh" content="0; url=https://polkadot.js.org/apps/">
-    <script type="text/javascript">
-        window.location.href = "https://polkadot.js.org/apps/"
-    </script>
-    <title>https://polkadot.js.org/apps/</title>
-  </head>
-  <body>
-    The "next" version is now part of the "master" branch. If you are not redirected automatically, follow this <a href="https://polkadot.js.org/apps/">https://polkadot.js.org/apps/</a> link.
-  </body>
-</html>

+ 13 - 2
packages/apps/webpack.base.config.js

@@ -86,6 +86,7 @@ function createWebpack (ENV, context) {
           ]
         },
         {
+          exclude: [/semantic-ui-css/],
           test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
           use: [
             {
@@ -99,6 +100,7 @@ function createWebpack (ENV, context) {
           ]
         },
         {
+          exclude: [/semantic-ui-css/],
           test: [/\.eot$/, /\.ttf$/, /\.svg$/, /\.woff$/, /\.woff2$/],
           use: [
             {
@@ -109,6 +111,15 @@ function createWebpack (ENV, context) {
               }
             }
           ]
+        },
+        {
+          include: [/semantic-ui-css/],
+          test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/, /\.eot$/, /\.ttf$/, /\.svg$/, /\.woff$/, /\.woff2$/],
+          use: [
+            {
+              loader: require.resolve('null-loader')
+            }
+          ]
         }
       ]
     },
@@ -157,13 +168,13 @@ function createWebpack (ENV, context) {
             chunks: 'initial',
             enforce: true,
             name: 'other.01',
-            test: /node_modules\/(@babel|ansi-styles|asn1|browserify-|chalk|color|color-|crypto-browserify|des\.js|diffie-hellman|elliptic|event-emitter|events|eventemitter3|hash|hmac-drbg|js-sha3|lodash|md5|memoizee|miller-rabin|object-|path-|parse-asn1|pbkdf2|process|public-encrypt|query-string|ripemd160|readable-stream|regenerator-runtime|rtcpeerconnection-shim|stream-browserify|store|timers-browserify|tslib|unified|unist-util|util|vfile|vm-browserify|webrtc-adapter|whatwg-fetch|xxhashjs)/
+            test: /node_modules\/(@babel|ansi-styles|asn1|browserify-|buffer|chalk|color|color-|crypto-browserify|des\.js|diffie-hellman|elliptic|event-emitter|events|eventemitter3|hash|hmac-drbg|js-sha3|lodash|memoizee|object-|path-|parse-asn1|pbkdf2|process|public-encrypt|query-string|ripemd160|readable-stream|regenerator-runtime|rtcpeerconnection-shim|safe-buffer|stream-browserify|store|timers-browserify|tslib|unified|unist-util|util|vfile|vm-browserify|webrtc-adapter|whatwg-fetch|xxhashjs)/
           },
           vendor02: {
             chunks: 'initial',
             enforce: true,
             name: 'other.02',
-            test: /node_modules\/(attr-accept|base-x|base64-js|blakejs|bip39|bip66|bn\.js|brorand|buffer|camelcase|cipher-base|core-js|core-util|create-|cuint|decode-uri|deep-equal|define-properties|detect-browser|es-abstract|es5-ext|es6-symbol|extend|function-bind|has-symbols|history|html-parse|ieee754|ip-|is-|minimalistic-crypto-utils|moment|next-tick|node-libs-browser|randombytes|randomfill|regexp|rxjs|safe-buffer|scheduler|sdp|secp256k1|setimmediate|sha\.js|through)/
+            test: /node_modules\/(attr-accept|base-x|base64-js|blakejs|bip39|bip66|bn\.js|brorand|camelcase|cipher-base|core-js|core-util|create-|cuint|decode-uri|deep-equal|define-properties|detect-browser|es-abstract|es5-ext|es6-symbol|extend|function-bind|has-symbols|history|html-parse|ieee754|ip-|is-|md5|miller-rabin|minimalistic-crypto-utils|moment|next-tick|node-libs-browser|randombytes|randomfill|regexp|rxjs|scheduler|sdp|secp256k1|setimmediate|sha\.js|through)/
           }
         }
       }

+ 13 - 0
yarn.lock

@@ -3248,6 +3248,7 @@ __metadata:
     html-webpack-plugin: ^4.3.0
     markdown-loader: ^5.1.0
     mini-css-extract-plugin: ^0.9.0
+    null-loader: ^4.0.0
     query-string: ^6.13.1
     style-loader: ^1.2.1
     thread-loader: ^2.1.3
@@ -17013,6 +17014,18 @@ __metadata:
   languageName: node
   linkType: hard
 
+"null-loader@npm:^4.0.0":
+  version: 4.0.0
+  resolution: "null-loader@npm:4.0.0"
+  dependencies:
+    loader-utils: ^2.0.0
+    schema-utils: ^2.6.5
+  peerDependencies:
+    webpack: ^4.0.0 || ^5.0.0
+  checksum: 3/903d4697ae960b067ea0a85597b718202d324338b8dbba1d55b0fe3f115f1dbd32a833aaff8b198552156748bab5e71b1355442969e382b3fbb379e7321e346b
+  languageName: node
+  linkType: hard
+
 "num2fraction@npm:^1.2.2":
   version: 1.2.2
   resolution: "num2fraction@npm:1.2.2"