2016-12-12 3 views
1

webpack 기반 응용 프로그램에 설치 프로그램을 설치하려고합니다.webpack이있는 Bunyan - shimmed 된 fs에 액세스하려고 시도했습니다.

I가 다음 웹팩 구성 :

{ 
      level: "trace", 
      path: "/logs/trace.log" 
      // Logging from external libraries used by your app or very detailed application logging. 
     }, 
     { 
      level: "debug", 
      path: "/logs/debug.log" 
      // Anything else, i.e. too verbose to be included in "info" level. 
     }, 
     { 
      level: "info", 
      path: "/logs/info.log" 
      // Detail on regular operation. 
     }, 
     { 
      level: "warn", 
      path: "/logs/warn.log" 
      // A note on something that should probably be looked at by an operator eventually. 
     }, 
     { 
      level: "error", 
      stream: process.stderr // we pipe error also to stdout 
      // Fatal for a particular request, but the service/app continues 
      // servicing other requests. An operator should look at this soon(ish). 
     }, 
     { 
      level: "error", 
      path: "/logs/error.log" 
      // Fatal for a particular request, but the service/app continues 
      // servicing other requests. An operator should look at this soon(ish). 
     }, 
     { 
      level: "fatal", 
      path: "/logs/fatal.log" 
      // The service/app is going to stop or become unusable now. 
      // An operator should definitely look into this soon. 
     } 

내가 시도 : 빈 심의 빈 파일

그리고 내 로거에 정의 된 다음 스트림에게 있습니다

// these shims are needed for bunyan 
     alias: { 
      'dtrace-provider': path.resolve('empty-shim.js'), 
      "fs": path.resolve('empty-shim.js'), 
      'safe-json-stringify': path.resolve('empty-shim.js'), 
      "mv": path.resolve('empty-shim.js'), 
      'source-map-support': path.resolve('empty-shim.js') 
     } 

내 로거에 액세스하지만이 오류가 발생합니다.

Uncaught TypeError: fs.createWriteStream is not a function 
    at Logger.addStream (http://localhost:8080/bundle.js:81080:28) 
    at http://localhost:8080/bundle.js:80958:19 
    at Array.forEach (native) 
    at new Logger (http://localhost:8080/bundle.js:80957:26) 
    at Function.createLogger (http://localhost:8080/bundle.js:82060:13) 
    at BunyanLogger.getLogger (http://localhost:8080/bundle.js:80479:18) 

fs가 빈 파일로 shimmed 된 원인이라고 가정합니다.

어떻게 작동합니까?

답변

0

bunyan 대신에 bunyan-sfdx-no-dtrace 앨리어싱으로이 성가심을 해결했습니다. dtrace 항목을 제거하는 포크입니다.

은 여기 내 webpack.config.js

module.exports = { 
    resolve: { 
    alias: { 
     bunyan: "bunyan-sfdx-no-dtrace" 
    } 
    } 
}; 

면책 조항 AFAICT 단지 관련 비트 둘 자체도 번연 - sfdx 노 DTrace를 번연이 적극적으로 제대로 그래서 구매자가 조심 유지되지 /되어있어. 나는 번니가 필요한 모듈의 하위 의존성이기 때문에이 문제를 처리해야했습니다.

관련 문제