File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/create-react-scripts-ssr Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,18 @@ const fs = require('fs');
44const path = require ( 'path' ) ;
55const AssetsPlugin = require ( 'assets-webpack-plugin' ) ;
66
7+
8+ function ensureSlash ( path , needsSlash ) {
9+ const hasSlash = path . endsWith ( '/' ) ;
10+ if ( hasSlash && ! needsSlash ) {
11+ return path . substr ( path , path . length - 1 ) ;
12+ } else if ( ! hasSlash && needsSlash ) {
13+ return `${ path } /` ;
14+ } else {
15+ return path ;
16+ }
17+ }
18+
719module . exports = ( ) => ( {
820 paths ( paths ) {
921 // we need to make it compatiable to create-react-scripts-typescript
@@ -55,7 +67,7 @@ module.exports = () => ({
5567 fullPath : true ,
5668 processOutput : ( assets ) => {
5769 Object . values ( assets ) . forEach ( mod => {
58- if ( mod . js ) mod . js = config . output . publicPath + path . join ( pluginOptions . path || '' , mod . js ) ;
70+ if ( mod . js ) mod . js = ensureSlash ( config . output . publicPath , true ) + path . join ( pluginOptions . path || '' , mod . js ) ;
5971 } ) ;
6072 return JSON . stringify ( assets ) ;
6173 }
You can’t perform that action at this time.
0 commit comments