-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to alias "app/index.jsx", it does not exist #1
Comments
Hi, thanks for reporting this. I can confirm this happening with the component-build command but it doesn't seem to happen with custom build scripts (using component/builder.js manually like the example in the readme.md). I'm taking a look to see what's going on in builder that's making it ignore the request to remove the .jsx files from the build. |
componentjs/builder.js#125 is the issue that's causing it (with the fix, but it's been open for 4 months). I'm going to see if I can get someone on #components to review that PR and get it merged today, if not, will move component-react to look for Either way, I'll make sure it works for |
Thanks! BTW, the JSX transformer will just skip any |
Not much traction from upstream component/builder, and looking more deeply into this, I realised it was probably safer for the long-run to have our own array for React files, in case there are any regressions etc (it's a tricky bit of code in builder). So, for the latest published version (1.0.0), you can put the JSX files into a Let me know if you have any issues, thanks again for reporting, I was using manual building so would never have come across it! P.S. I also published njpatel/react and njpatel/react-with-addons if you'd like to have the react.js available as a component dependancy (just looking at your project layout). Adding in component-minify as the last stage should give you minified (& uglified if you'd like) output as well (as most of the JS in Components isn't ready for production afaict). |
Thanks! Using the latest version, and your react component, I can't get my app rendering. The build is created and there are no errors, but nothing seems to get run. Any idea what the problem is? Simplified example files below.
component.json {
"dependencies": {
"njpatel/react": "*"
},
"main": "index.js",
"react": [
"index.js"
],
"remotes": []
} package.json {
"private": true,
"dependencies": {},
"devDependencies": {
"component": "~0.19.3",
"component-react": "~1.0.0"
},
"scripts": {
"build": "component build --use component-react"
}
} index.js /** @jsx React.DOM */
var React = require('react');
var App = React.createClass({
render: function () {
return (
<div className="App">
hi
</div>
)
}
});
React.renderComponent(
<App />,
document.getElementById('example')
) index.html <!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="example"></div>
<script src="build/build.js"></script>
</body>
</html> |
Yep. Your build.js will be wrapping your index.js in a require module, so you'll want to add a small script portion to your HTML to be able to call 'require("your-module-name")'. This is a Component thing and hence it's always good to have a 'name' key in your component.json, as that is your module name (you'll see it in the require registry in your build.js). Component is really nice but needs better docs! I hope that helps. |
Ah, thanks! |
Using the For example, in a local component dir that you let
Without doubling up on |
Yep, unfortunately the 'main' file does need to be included in scripts otherwise builder get's confused (this would partially be fixed with the branch I mentioned earlier). However it's only necessary for the main file, not every file needs to be added there. I pushed a more complete example just now that uses local components (in multiple files). I thought about just parsing anything that is in scripts through react, but the problem is that they could be read from disk multiple times by the builder for itself and also by other plugins, so it could get messy. Having 'react' gives a sanitised space to work from (should there be more options etc in the future from the React team for compiling). |
I see. But if you have each component in its own directory (multiple local components), then you have to do it for every |
Yep, it's a pain for sure, just not a lot I can do about it from the plugin side. I've tried a few things, but for one thing they fix, they introduce other weirdness or errors. Sorry :/ |
I'm getting the following error in the resulting build:
Example directory structure of the app:
Root component.json:
App component's json:
Run a build with:
It generates the following build:
The text was updated successfully, but these errors were encountered: