Skip to content

Commit 01ee481

Browse files
committed
build(extension): migrate to esm to pass the firefox addon file size limit
1 parent 81a9b01 commit 01ee481

File tree

3 files changed

+28
-25
lines changed

3 files changed

+28
-25
lines changed

packages/client/src/main.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ import { getViteClient } from 'vite-hot-client'
77
import { createApp } from 'vue'
88
import { createMemoryHistory, createRouter } from 'vue-router'
99
import WaitForConnection from '~/components/WaitForConnection.vue'
10-
import Assets from '~/pages/assets.vue'
11-
import Components from '~/pages/components.vue'
12-
import CustomInspectorTabView from '~/pages/custom-inspector-tab-view.vue'
13-
import CustomTabView from '~/pages/custom-tab-view.vue'
14-
import Graph from '~/pages/graph.vue'
15-
import Overview from '~/pages/overview.vue'
16-
import Pages from '~/pages/pages.vue'
17-
import PiniaPage from '~/pages/pinia.vue'
18-
import RouterPage from '~/pages/router.vue'
19-
import Settings from '~/pages/settings.vue'
20-
import Timeline from '~/pages/timeline.vue'
2110
import App from './App.vue'
2211
import '@unocss/reset/tailwind.css'
2312
import 'uno.css'
@@ -27,17 +16,17 @@ import '~/assets/styles/main.css'
2716

2817
const routes = [
2918
{ path: '/', redirect: '/components' },
30-
{ path: '/overview', component: Overview },
31-
{ path: '/components', component: Components },
32-
{ path: '/pinia', component: PiniaPage },
33-
{ path: '/router', component: RouterPage },
34-
{ path: '/pages', component: Pages },
35-
{ path: '/timeline', component: Timeline },
36-
{ path: '/assets', component: Assets },
37-
{ path: '/graph', component: Graph },
38-
{ path: '/settings', component: Settings },
39-
{ path: `/${CUSTOM_TAB_VIEW}/:name`, component: CustomTabView },
40-
{ path: `/${CUSTOM_INSPECTOR_TAB_VIEW}/:name`, component: CustomInspectorTabView },
19+
{ path: '/overview', component: () => import('~/pages/overview.vue') },
20+
{ path: '/components', component: () => import('~/pages/components.vue') },
21+
{ path: '/pinia', component: () => import('~/pages/pinia.vue') },
22+
{ path: '/router', component: () => import('~/pages/router.vue') },
23+
{ path: '/pages', component: () => import('~/pages/pages.vue') },
24+
{ path: '/timeline', component: () => import('~/pages/timeline.vue') },
25+
{ path: '/assets', component: () => import('~/pages/assets.vue') },
26+
{ path: '/graph', component: () => import('~/pages/graph.vue') },
27+
{ path: '/settings', component: () => import('~/pages/settings.vue') },
28+
{ path: `/${CUSTOM_TAB_VIEW}/:name`, component: () => import('~/pages/custom-tab-view.vue') },
29+
{ path: `/${CUSTOM_INSPECTOR_TAB_VIEW}/:name`, component: () => import('~/pages/custom-inspector-tab-view.vue') },
4130
]
4231

4332
const router = createRouter({

packages/firefox-extension/devtools-panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<div id="container">
2020
<div id="app"></div>
2121
</div>
22-
<script src="../dist/devtools-panel.js"></script>
22+
<script type="module" src="../dist/devtools-panel.js"></script>
2323
</body>
2424
</html>

packages/firefox-extension/tsup.config.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defineConfig } from 'tsup'
22

3-
export default defineConfig({
3+
export default defineConfig([{
44
entryPoints: [
55
'src/*.ts',
6+
'!src/devtools-panel.ts',
67
],
78
esbuildOptions(options) {
89
if (options.format === 'iife')
@@ -16,4 +17,17 @@ export default defineConfig({
1617
clean: true,
1718
format: ['iife'],
1819
minify: true,
19-
})
20+
}, {
21+
entryPoints: [
22+
'src/devtools-panel.ts',
23+
],
24+
define: {
25+
'process.env': JSON.stringify(process.env),
26+
'__VUE_OPTIONS_API__': 'true',
27+
'__VUE_PROD_DEVTOOLS__': 'true',
28+
},
29+
clean: true,
30+
format: ['esm'],
31+
minify: true,
32+
noExternal: ['@vue/devtools-core', '@vue/devtools-kit', '@vue/devtools-shared'],
33+
}])

0 commit comments

Comments
 (0)