Skip to content

Commit 1b71b24

Browse files
authored
Merge pull request #5 from oslabs-beta/rydang/react
changed file structure and react now renders on page
2 parents f82accb + 351e9c3 commit 1b71b24

File tree

7 files changed

+38
-7
lines changed

7 files changed

+38
-7
lines changed

extension/app/components/App.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React, { Component } from 'react';
2+
3+
const App = () => (
4+
<div>
5+
App
6+
</div>
7+
);
8+
9+
export default App;

extension/app/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './components/App';
4+
5+
ReactDOM.render(
6+
<App />, document.getElementById('root'),
7+
);

extension/devtools.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
<html lang="en">
33

44
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>React Time Travel</title>
59
</head>
610

711
<body>
8-
<script src="dist/main.bundle.js"></script>
9-
</body>
12+
<script type="text/javascript" src="devtools.js"></script>
13+
</body>
1014

1115
</html>
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
chrome.devtools.panels.create('React Time-Travel', null, 'panel.html', (panel) => { });
1+
chrome.devtools.panels.create('React Time-Travel', null, 'panel.html', (panel) => {
2+
console.log('created');
3+
});

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"devtools_page": "devtools.html",
55
"description": "A Chrome extension that helps debug React by memorizing the state of components with every render.",
66
"manifest_version": 2,
7-
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
7+
"content_security_policy": "script-src 'self' 'unsafe-eval' ; object-src 'self'"
88
}

extension/panel.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
45
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width, initial-scale=1.0">
67
<meta http-equiv="X-UA-Compatible" content="ie=edge">
78
<title>Document</title>
89
</head>
10+
911
<body>
10-
time test 1
12+
<div id="root" />
13+
<script type="text/javascript" src="dist/app.bundle.js"></script>
1114
</body>
15+
1216
</html>

webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const ChromeExtensionReloader = require('webpack-chrome-extension-reloader');
33

44
const config = {
55
entry: {
6-
main: './extension/index.js',
6+
app: './extension/app/index.js',
77
background: './extension/background.js',
88
},
99
output: {
@@ -39,7 +39,12 @@ const config = {
3939

4040
module.exports = (env, argv) => {
4141
if (argv.mode === 'development') {
42-
config.plugins.push(new ChromeExtensionReloader());
42+
config.plugins.push(new ChromeExtensionReloader({
43+
entries: {
44+
contentScript: ['app'],
45+
background: ['background'],
46+
},
47+
}));
4348
}
4449
return config;
4550
};

0 commit comments

Comments
 (0)