-
-
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
Changes from 1 commit
0081f76
17ced6b
24c9c9b
e2dc775
d16a092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 || '/'; | ||
|
||
module.exports = { | ||
bail: true, | ||
|
@@ -35,9 +36,7 @@ module.exports = { | |
path: buildPath, | ||
filename: '[name].[chunkhash].js', | ||
chunkFilename: '[name].[chunkhash].chunk.js', | ||
// 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 commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it’s best to infer just the path portion? e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}, | ||
resolve: { | ||
extensions: ['', '.js'], | ||
|
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 likepath.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 thetemplate
folder. I can include a samplepackage.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.