Преглед на файлове

Improve Webpack configuration (#215)

Roj преди 3 години
родител
ревизия
24abd25a72
променени са 3 файла, в които са добавени 6 реда и са изтрити 9 реда
  1. 1 1
      examples/simpleLogin.html
  2. 2 2
      examples/simpleLogin.js
  3. 3 6
      webpack.config.js

+ 1 - 1
examples/simpleLogin.html

@@ -34,7 +34,7 @@
       </div>
     </form>
   </body>
-  <script src="../browser/gramjs.js"></script>
+  <script src="../browser/telegram.js"></script>
   <!--Loading the library-->
   <script src="betterLogging.js"></script>
   <!--beautifies the ouput (this rewrites console.log)-->

+ 2 - 2
examples/simpleLogin.js

@@ -51,8 +51,8 @@ function codeCallback() {
   });
 }
 
-const { TelegramClient } = gramjs;
-const { StringSession } = gramjs.sessions;
+const { TelegramClient } = telegram;
+const { StringSession } = telegram.sessions;
 const apiId = 1; // put your api id here [for example 123456789]
 const apiHash = "1  "; // put your api hash here [for example '123456abcfghe']
 

+ 3 - 6
webpack.config.js

@@ -19,7 +19,6 @@ module.exports = {
       },
     ],
   },
-
   resolve: {
     extensions: [".tsx", ".ts", ".js"],
     fallback: {
@@ -34,7 +33,7 @@ module.exports = {
       constants: false,
     },
   },
-  mode: "development",
+  mode: process.env.NODE_ENV ?? "development",
   plugins: [
     new webpack.ProvidePlugin({
       Buffer: ["buffer", "Buffer"],
@@ -43,12 +42,10 @@ module.exports = {
       process: "process/browser",
     }),
   ],
-
   output: {
-    library: "gramjs",
+    library: "telegram",
     libraryTarget: "umd",
-    auxiliaryComment: "Test Comment",
-    filename: "gramjs.js",
+    filename: "telegram.js",
     path: path.resolve(__dirname, "browser"),
   },
 };