Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
fix: publicPath had // when basePath is / and publicPath is / (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau authored Feb 17, 2017
1 parent 5cf9628 commit 52f68fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@ export default () => {
);

// Prepend / to publicPath and basePath if necessary
const prependSlash = path => (path.match(/^(http|\/|$)/) ? '' : '/') + path;
const prependSlash = path => (
((path.startsWith('/') || path.match(/^(http|\/|$)/)) ? '' : '/') + path
);
[['publicPath'], ['basePath']].forEach(
path => updatePath(path, prependSlash, config),
);

// If public path is not absolute url, prepend basePath
updatePath(['publicPath'], publicPath =>
(!publicPath.match(/^(http|\/\/)/) ? config.basePath : '') + config.publicPath,
(!publicPath.match(/^(http|\/\/)/) ? config.basePath.replace(/\/$/, '') : '') + config.publicPath,
config);

return {
Expand Down
2 changes: 1 addition & 1 deletion examples/counter/.vitaminrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"basePath": "/piouaoaa",
"basePath": "/",
"publicPath": "",
"routes": "./routes",
"redux": {
Expand Down

0 comments on commit 52f68fa

Please sign in to comment.