File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ module.exports = {
54
54
* @return {String }
55
55
*/
56
56
getRelativeOutputPath ( webpackConfig ) {
57
- return webpackConfig . outputPath . replace ( webpackConfig . getContext ( ) + '/' , '' ) ;
57
+ return webpackConfig . outputPath . replace ( webpackConfig . getContext ( ) + path . sep , '' ) ;
58
58
} ,
59
59
60
60
/**
Original file line number Diff line number Diff line change @@ -124,4 +124,32 @@ describe('path-util getContentBase()', () => {
124
124
} ) . to . throw ( 'Cannot determine how to prefix the keys in manifest.json. Call Encore.setManifestKeyPrefix() to choose what path (e.g. build/) to use' ) ;
125
125
} ) ;
126
126
} ) ;
127
+
128
+ describe ( 'getRelativeOutputPath' , ( ) => {
129
+ it ( 'Works with Unix paths' , function ( ) {
130
+ if ( isWindows ( ) ) {
131
+ this . skip ( ) ;
132
+ }
133
+
134
+ const config = createConfig ( ) ;
135
+ config . runtimeConfig . context = '/tmp/webpack-encore' ;
136
+ config . outputPath = '/tmp/webpack-encore/public/build' ;
137
+
138
+ const actualPath = pathUtil . getRelativeOutputPath ( config ) ;
139
+ expect ( actualPath ) . to . equal ( 'public/build' ) ;
140
+ } ) ;
141
+
142
+ it ( 'Works with Windows paths' , function ( ) {
143
+ if ( ! isWindows ( ) ) {
144
+ this . skip ( ) ;
145
+ }
146
+
147
+ const config = createConfig ( ) ;
148
+ config . runtimeConfig . context = 'C:\\projects\\webpack-encore' ;
149
+ config . outputPath = 'C:\\projects\\webpack-encore\\public\\build' ;
150
+
151
+ const actualPath = pathUtil . getRelativeOutputPath ( config ) ;
152
+ expect ( actualPath ) . to . equal ( 'public\\build' ) ;
153
+ } ) ;
154
+ } ) ;
127
155
} ) ;
You can’t perform that action at this time.
0 commit comments