Skip to content

Commit

Permalink
fix: undefined config during build (#158)
Browse files Browse the repository at this point in the history
* fix: undefined version config

* chore: lint fix

* chore: revert auto-lint fix change
  • Loading branch information
Anush008 committed Jun 3, 2023
1 parent dde39f1 commit c986086
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/content-scripts/github.ts
Expand Up @@ -60,7 +60,7 @@ void processGithubPage();
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
switch (msg.type) {
case "get_highlight": {
const title = (document.querySelector(".js-issue-title.markdown-title") as HTMLHeadingElement)?.innerText;
const title = (document.querySelector(".js-issue-title.markdown-title") as HTMLHeadingElement).innerText;

Check warning on line 63 in src/content-scripts/github.ts

View workflow job for this annotation

GitHub Actions / test / Code standards

Use a ! assertion to more succinctly remove null and undefined from the type

sendResponse(title);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/help.tsx
Expand Up @@ -7,7 +7,7 @@ import {
} from "react-icons/hi2";
import { goBack } from "react-chrome-extension-router";
import { VscIssues } from "react-icons/vsc";
const { version } = config;
import { version } from "../../package.json";

const Help = () => (
<div className="p-4 bg-slate-800">
Expand Down
3 changes: 1 addition & 2 deletions src/vite-env.d.ts
@@ -1,2 +1 @@
/// <reference types="vite/client" />
declare var config: Record<string, string>;
/// <reference types="vite/client" />
5 changes: 1 addition & 4 deletions vite.config.ts
Expand Up @@ -5,8 +5,5 @@ import manifest from "./manifest.json" assert { type: "json" };

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), crx({ manifest })],
define: {
'config.version': JSON.stringify(process.env.npm_package_version),
}
plugins: [react(), crx({ manifest })]
});

0 comments on commit c986086

Please sign in to comment.