File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ process.on('message', (message) => {});
5858| :--:| :--:| :-----:| :----------|
5959| [ ** ` name ` ** ] ( #name ) | ` {String} ` | ` [hash].fork.js ` | Set a custom name for the output script|
6060| [ ** ` publicPath ` ** ] ( #publicPath ) | ` {String} ` | ` null ` | Override the path from which fork scripts are downloaded|
61+ | [ ** ` evalPath ` ** ] ( #publicPath ) | ` {Boolean} ` | ` null ` | if ` publicPath ` is treat as a static ` String ` |
62+
6163
6264### ` name `
6365
@@ -84,6 +86,18 @@ webpack assets is used
8486}
8587```
8688
89+ ### ` evalPath `
90+
91+ if wants to get dynamic publicPath like '__ dirname', you should set ` evalPath = true `
92+
93+ ** webpack.config.js**
94+ ``` js
95+ {
96+ loader: ' webpack-fork-loader'
97+ options: { publicPath: ' __dirname + "/"' , evalPath: true }
98+ }
99+ ```
100+
87101## License
88102
89103#### [ MIT] ( ./LICENSE )
Original file line number Diff line number Diff line change 11{
22 "name" : " webpack-fork-loader" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "author" : " githoniel" ,
55 "description" : " fork loader module for webpack packing electron" ,
66 "repository" : " https://github.com/githoniel/webpack-fork-loader.git" ,
Original file line number Diff line number Diff line change 66 },
77 "publicPath" : {
88 "type" : " string"
9+ },
10+ "evalPath" : {
11+ "type" : " boolean"
912 }
1013 },
1114 "additionalProperties" : false
Original file line number Diff line number Diff line change 11/* eslint-disable multiline-ternary */
22const getWorker = ( file , content , options ) => {
3- const publicPath = options . publicPath
4- ? JSON . stringify ( options . publicPath )
5- : '__webpack_public_path__' ;
3+ let publicPath ;
4+ if ( options . publicPath ) {
5+ publicPath = options . evalPath ? options . publicPath : JSON . stringify ( options . publicPath ) ;
6+ } else {
7+ publicPath = '__webpack_public_path__' ;
8+ }
69
710 const publicWorkerPath = `${ publicPath } + ${ JSON . stringify ( file ) } ` ;
811
You can’t perform that action at this time.
0 commit comments