Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: undefined config during build #158

Merged
merged 3 commits into from Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/content-scripts/github.ts
Expand Up @@ -60,7 +60,7 @@
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 })]
});