0

I am familiar with Chrome's policy on inline scripts in Extensions. However, I don't think I have one in my files? All I have is very basic and I'm just attempting to place an input field onto the page.

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"
  ]
}
1
  • What is the actual full text of the error message? Commented Dec 3, 2016 at 23:57

1 Answer 1

2

I believe the problem is that in this version of Babel you can't just prototype a site and include the library in a script tag, or it'll execute in-line. I don't have this problem anymore going through the Browserify route.

Sign up to request clarification or add additional context in comments.

1 Comment

To clarify for others who may find find this question. The way babel-standalone operates is by using unsafe operations that are not permitted in browser extensions. This is why you have to precompile your files before including them to html (e.g. with browserify, webpack, parcel e.t.c)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.