我熟悉Chrome在扩展程序中内联脚本的政策。但是,我认为我的文件中没有一个?我所拥有的只是非常基本的,我只是试图在页面上放置一个输入字段。
main.js:
class Container extends React.Component {
render() {
return (
<div className="locationSearchBarContainer">
<SearchBar />
</div>
);
}
}
class SearchBar extends React.Component {
render() {
return (
<input className="searchBar" id="locationSearchBar" />
);
}
}
ReactDOM.render(
<Container />,
document.getElementById('container')
);
main.html中:
<!doctype html>
<html>
<head>
<title>New Tab</title>
<script src="../scripts/plugins/react.min.js"></script>
<script src="../scripts/plugins/react-dom.min.js"></script>
<script src="../scripts/plugins/babel.min.js" charset="utf-8"></script>
<script src="../scripts/main.js" type="text/babel"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
的manifest.json
{
"manifest_version": 2,
"name": "",
"description": "See what's happening around you and add events to your calendar",
"version": "0.01",
"browser_action": {
"default_icon": "img/icon.png",
"default_title": "Click here!"
},
"chrome_url_overrides" : {
"newtab": "html/main.html"
},
"permissions": [
"activeTab"
]
}
答案 0 :(得分:2)
我认为问题在于,在这个版本的Babel中,您不能只是将网站原型化并将库包含在脚本标记中,或者它将在线执行。我不再有这个问题通过Browserify路线了。