Skip to content

Commit 338de4e

Browse files
committed
Make Typescript work out of the box
1 parent 1b9c854 commit 338de4e

File tree

4 files changed

+48
-7
lines changed

4 files changed

+48
-7
lines changed

package-lock.json

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@types/chrome": "0.0.132",
1818
"@types/react": "^17.0.2",
1919
"@types/react-dom": "^17.0.1",
20+
"@types/webpack-env": "^1.16.0",
2021
"react": "^17.0.1",
2122
"react-dom": "^17.0.1",
2223
"react-hot-loader": "^4.13.0",

src/types.d.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
declare module '*.jpg' {
2+
const value: string;
3+
export default value;
4+
}
5+
6+
declare module '*.jpeg' {
7+
const value: string;
8+
export default value;
9+
}
10+
11+
declare module '*.png' {
12+
const value: string;
13+
export default value;
14+
}
15+
16+
declare module '*.gif' {
17+
const value: string;
18+
export default value;
19+
}
20+
21+
declare module '*.svg' {
22+
const value: string;
23+
export default value;
24+
}
25+
26+
declare module '*.module.scss' {
27+
const value: { [key: string]: string };
28+
export default value;
29+
}

webpack.config.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ if (fileSystem.existsSync(secretsPath)) {
3636
var options = {
3737
mode: process.env.NODE_ENV || 'development',
3838
entry: {
39-
newtab: path.join(__dirname, 'src', 'pages', 'Newtab', 'index.jsx'),
40-
options: path.join(__dirname, 'src', 'pages', 'Options', 'index.jsx'),
41-
popup: path.join(__dirname, 'src', 'pages', 'Popup', 'index.jsx'),
42-
background: path.join(__dirname, 'src', 'pages', 'Background', 'index.js'),
43-
contentScript: path.join(__dirname, 'src', 'pages', 'Content', 'index.js'),
44-
devtools: path.join(__dirname, 'src', 'pages', 'Devtools', 'index.js'),
45-
panel: path.join(__dirname, 'src', 'pages', 'Panel', 'index.jsx'),
39+
newtab: path.join(__dirname, 'src', 'pages', 'Newtab'),
40+
options: path.join(__dirname, 'src', 'pages', 'Options'),
41+
popup: path.join(__dirname, 'src', 'pages', 'Popup'),
42+
background: path.join(__dirname, 'src', 'pages', 'Background'),
43+
contentScript: path.join(__dirname, 'src', 'pages', 'Content'),
44+
devtools: path.join(__dirname, 'src', 'pages', 'Devtools'),
45+
panel: path.join(__dirname, 'src', 'pages', 'Panel'),
4646
},
4747
chromeExtensionBoilerplate: {
4848
notHotReload: ['contentScript', 'devtools'],

0 commit comments

Comments
 (0)