-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Don't assume the project is hosted at the root #94
Conversation
* Require package.json in webpack.config.prod.js and use homepage if set; otherwise use '/'
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
@sotojuan Looks like @dhruska beat you to it—did you have a similar implementation in mind? Are there any edge cases you can see here? @dhruska Thanks for contributing! I’ll review next week, I need to get some sleep after releasing. 😄 Next time I’d appreciate if you coordinated on the issue first because it’s frustrating when somebody already starts their work, and then somebody else submits a PR. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Yeah that looks fine, no problem! Looks good @dhruska! |
I'm having trouble viewing the build details - getting As for the README do you think we should mention that the prod package url is read from package.json, or put that in the creation flow? |
@@ -26,6 +26,7 @@ var nodeModulesPath = path.join(__dirname, '..', 'node_modules'); | |||
var indexHtmlPath = path.resolve(__dirname, relativePath, 'index.html'); | |||
var faviconPath = path.resolve(__dirname, relativePath, 'favicon.ico'); | |||
var buildPath = path.join(__dirname, isInNodeModules ? '../../..' : '..', 'build'); | |||
var publicPath = require('./package.json').homepage || '/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json
might not be there. I think you need to use something like path.resolve(__dirname, relativePath, 'package.json');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that, but then I run into an error that there is no package.json
in the template
folder. I can include a sample package.json
in that folder and then the tests will successfully run - are you ok with that @gaearon ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a dummy package json there sounds reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THANK U every much, try to config package.json with "homepage":"./"
make it work on default app.
I’ll check in with our team about Travis permissions, stay tuned 👍 |
For now you can run |
If you push again, Travis should pick this up now. We fixed permissions. |
Sounds great - I can access Travis now. Added a sample package.json per our conversation above and fixed the file path. |
// TODO: this wouldn't work for e.g. GH Pages. | ||
// Good news: we can infer it from package.json :-) | ||
publicPath: '/' | ||
publicPath: publicPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it’s best to infer just the path portion? e.g. stuff.com/wow
should give us just /wow
.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, agreed - good call. Putting together a regex that could do it, but do you think there is a more elegant way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
url.parse()
gives you an object with pathname
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. Thanks for bearing with me. Added that, so we should now always have the path portion of the url defined in homepage
, or /
if it isn't defined.
This looks very good. The only problem I see so far is that our instructions no longer work in this case:
Not sure how to fix this yet. |
Let’s change the message to
(only when |
You will also need to add a section in howto ( |
console.log(' hs'); | ||
console.log(' ' + openCommand + ' http://localhost:8080'); | ||
console.log(); | ||
console.log('You can now deploy and serve it from <homepage>.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep the previous message for the simple case.
This code should check whether the homepage
was set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just pushed an update for that - will work on instructions for publishing to GH Pages.
A great start would be to (after setting the project page
|
I learned that today too! Haha |
Wow, that is awesome! |
FYI, I continued this in #162. |
Upgrade to typescript 2.4 and ts-loader 2.2.1
Support custom config on running tests as well (e.g. for decorators)
Fixes #21