소스 검색

fix: background script not running on production

Ahmad Kholid 3 년 전
부모
커밋
e3b601660e
3개의 변경된 파일21개의 추가작업 그리고 21개의 파일을 삭제
  1. 9 5
      src/background/index.js
  2. 0 4
      src/store/index.js
  3. 12 12
      webpack.config.js

+ 9 - 5
src/background/index.js

@@ -60,7 +60,7 @@ browser.alarms.onAlarm.addListener(({ name }) => {
   });
 });
 
-browser.runtime.onInstalled.addListener((details) => {
+chrome.runtime.onInstalled.addListener((details) => {
   if (details.reason === 'install') {
     browser.storage.local
       .set({
@@ -71,10 +71,14 @@ browser.runtime.onInstalled.addListener((details) => {
         visitWebTriggers: [],
       })
       .then(() => {
-        browser.tabs.create({
-          active: true,
-          url: browser.runtime.getURL('newtab.html#/workflows'),
-        });
+        browser.tabs
+          .create({
+            active: true,
+            url: browser.runtime.getURL('newtab.html#/workflows'),
+          })
+          .catch((error) => {
+            console.error(error);
+          });
       });
   }
 });

+ 0 - 4
src/store/index.js

@@ -34,10 +34,6 @@ const store = createStore({
         });
         const { isFirstTime } = await browser.storage.local.get('isFirstTime');
 
-        console.log(
-          await browser.storage.local.get('isFirstTime'),
-          isFirstTime
-        );
         if (isFirstTime) {
           await dispatch('entities/insert', {
             entity: 'workflows',

+ 12 - 12
webpack.config.js

@@ -168,18 +168,18 @@ if (env.NODE_ENV === 'development') {
         extractComments: false,
       }),
     ],
-    runtimeChunk: 'single',
-    splitChunks: {
-      chunks: 'all',
-      maxInitialRequests: Infinity,
-      minSize: 0,
-      cacheGroups: {
-        vendor: {
-          test: /[\\/]node_modules[\\/]/,
-          name: 'vendor',
-        },
-      },
-    },
+    // runtimeChunk: 'single',
+    // splitChunks: {
+    //   chunks: 'all',
+    //   maxInitialRequests: Infinity,
+    //   minSize: 0,
+    //   cacheGroups: {
+    //     vendor: {
+    //       test: /[\\/]node_modules[\\/]/,
+    //       name: 'vendor',
+    //     },
+    //   },
+    // },
   };
 }