Skip to content

Commit

Permalink
Make Typescript work out of the box
Browse files Browse the repository at this point in the history
  • Loading branch information
kcirtaptrick committed May 23, 2021
1 parent 1b9c854 commit 11f7407
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@types/chrome": "0.0.132",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.1",
"@types/webpack-env": "^1.16.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-hot-loader": "^4.13.0",
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Popup/Popup.jsx → src/pages/Popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import logo from '../../assets/img/logo.svg';
import Greetings from '../../containers/Greetings/Greetings';
import './Popup.css';
import styles from './Popup.module.scss';

const Popup = () => {
return (
Expand Down
38 changes: 38 additions & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
declare module '*.jpg' {
const value: string;
export default value;
}

declare module '*.jpeg' {
const value: string;
export default value;
}

declare module '*.png' {
const value: string;
export default value;
}

declare module '*.gif' {
const value: string;
export default value;
}

declare module '*.svg' {
const value: string;
export default value;
}

declare module '*.module.css' {
const value: { [key: string]: string };
export default value;
}

declare module '*.module.scss' {
const value: { [key: string]: string };
export default value;
}
declare module '*.module.sass' {
const value: { [key: string]: string };
export default value;
}
14 changes: 7 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ if (fileSystem.existsSync(secretsPath)) {
var options = {
mode: process.env.NODE_ENV || 'development',
entry: {
newtab: path.join(__dirname, 'src', 'pages', 'Newtab', 'index.jsx'),
options: path.join(__dirname, 'src', 'pages', 'Options', 'index.jsx'),
popup: path.join(__dirname, 'src', 'pages', 'Popup', 'index.jsx'),
background: path.join(__dirname, 'src', 'pages', 'Background', 'index.js'),
contentScript: path.join(__dirname, 'src', 'pages', 'Content', 'index.js'),
devtools: path.join(__dirname, 'src', 'pages', 'Devtools', 'index.js'),
panel: path.join(__dirname, 'src', 'pages', 'Panel', 'index.jsx'),
newtab: path.join(__dirname, 'src', 'pages', 'Newtab'),
options: path.join(__dirname, 'src', 'pages', 'Options'),
popup: path.join(__dirname, 'src', 'pages', 'Popup'),
background: path.join(__dirname, 'src', 'pages', 'Background'),
contentScript: path.join(__dirname, 'src', 'pages', 'Content'),
devtools: path.join(__dirname, 'src', 'pages', 'Devtools'),
panel: path.join(__dirname, 'src', 'pages', 'Panel'),
},
chromeExtensionBoilerplate: {
notHotReload: ['contentScript', 'devtools'],
Expand Down

0 comments on commit 11f7407

Please sign in to comment.