wgt-node-utils 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +7 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -246,15 +246,15 @@ class wgtNodeUtils {
|
|
|
246
246
|
* node启动时将静态资源读取到内存中
|
|
247
247
|
* @buildName 打包名称
|
|
248
248
|
* @version 打包版本号
|
|
249
|
-
*
|
|
249
|
+
* @dirname 项目的绝对地址
|
|
250
250
|
*/
|
|
251
|
-
readF2eFiles = (buildName, version) => {
|
|
251
|
+
readF2eFiles = (buildName, version, dirname) => {
|
|
252
252
|
console.log('静态资源:开始读取');
|
|
253
253
|
return new Promise((resolve, reject) => {
|
|
254
254
|
try {
|
|
255
255
|
// 指定目录路径
|
|
256
|
-
console.log(
|
|
257
|
-
const directoryPath = path.join(
|
|
256
|
+
console.log(dirname, 'dirname')
|
|
257
|
+
const directoryPath = path.join(dirname, `../${buildName}/${version}`);
|
|
258
258
|
console.log(directoryPath, 'directoryPath')
|
|
259
259
|
// 读取目录下的所有文件
|
|
260
260
|
const files = fs.readdirSync(directoryPath);
|
|
@@ -270,9 +270,9 @@ class wgtNodeUtils {
|
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
272
|
// 增加react依赖
|
|
273
|
-
this.fileContents['react.production.min.js'] = fs.readFileSync(path.join(
|
|
274
|
-
this.fileContents['react-dom.production.min.js'] = fs.readFileSync(path.join(
|
|
275
|
-
this.fileContents['react-router-dom.min.js'] = fs.readFileSync(path.join(
|
|
273
|
+
this.fileContents['react.production.min.js'] = fs.readFileSync(path.join(dirname, `../${buildName}/dist/react.production.min.js`),'utf8');
|
|
274
|
+
this.fileContents['react-dom.production.min.js'] = fs.readFileSync(path.join(dirname, `../${buildName}/dist/react-dom.production.min.js`),'utf8');
|
|
275
|
+
this.fileContents['react-router-dom.min.js'] = fs.readFileSync(path.join(dirname, `../${buildName}/dist/react-router-dom.min.js`),'utf8');
|
|
276
276
|
|
|
277
277
|
console.log('静态资源列表:');
|
|
278
278
|
const f2eFileLoadStatus = Object.keys(this.fileContents).every((item) => {
|