Упругий APM-узел с Webpack, Typescript и ES6 не работает? - PullRequest
0 голосов
/ 19 июня 2019

Я использую установку TypeScript с webpack и babel и получаю следующую ошибку при попытке включить astic-apm-node . У меня есть настройки в переменных среды.

import * as apm from 'elastic-apm-node/start'
apm.flush()

Ошибка:

WARNING in node_modules/elastic-apm-node/lib/agent.js 152:16-59
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/index.js

WARNING in node_modules/elastic-apm-node/lib/config.js 25:19-36
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

WARNING in node_modules/elastic-apm-node/lib/instrumentation/index.js 169:16-30
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

ERROR in node_modules/elastic-apm-node/lib/agent.js
Module not found: Error: Can't resolve '../package' in 'node_modules/elastic-apm-node/lib'
 @ node_modules/elastic-apm-node/lib/agent.js 25:14-35

ERROR in node_modules/elastic-apm-node/lib/config.js
Module not found: Error: Can't resolve '../package' in 'node_modules/elastic-apm-node/lib'
 @ node_modules/elastic-apm-node/lib/config.js 12:14-35

ERROR in node_modules/elastic-apm-http-client/index.js
Module not found: Error: Can't resolve './package' in 'node_modules/elastic-apm-http-client'
 @ node_modules/elastic-apm-http-client/index.js 15:12-32

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-exceptions' in 'node_modules/spdx-expression-parse'
 @ node_modules/spdx-expression-parse/scan.js 6:17-43

ERROR in node_modules/spdx-correct/index.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'node_modules/spdx-correct'
 @ node_modules/spdx-correct/index.js 17:21-48

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids' in 'node_modules/spdx-expression-parse'
W20190619-11:37:30.394(2)? (STDERR)      @ node_modules/spdx-expression-parse/scan.js 4:10-37

ERROR in node_modules/spdx-expression-parse/scan.js
Module not found: Error: Can't resolve 'spdx-license-ids/deprecated' in 'node_modules/spdx-expression-parse'
 @ node_modules/spdx-expression-parse/scan.js 5:10-48

Есть идеи, как мне это предотвратить? При использовании только TypeScript с Meteor я не получаю ошибок, поэтому думаю, что он связан с Babel / Webpack.

1 Ответ

0 голосов
/ 24 июня 2019

Ответ на ошибки - у меня есть собственные resole.extensions в webpack.config.js:

resolve: {
  extensions: ['.ts', '.tsx', '.js', '.jsx']
},

Отсутствует значение по умолчанию .json:

resolve: {
  extensions: ['.ts', '.tsx', '.js', '.jsx', '.json']
},

Теперь остались только предупреждения:

WARNING in node_modules/elastic-apm-node/lib/agent.js 152:16-59
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/index.js

WARNING in node_modules/elastic-apm-node/lib/config.js 25:19-36
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

WARNING in node_modules/elastic-apm-node/lib/instrumentation/index.js 169:16-30
Critical dependency: the request of a dependency is an expression
 @ node_modules/elastic-apm-node/lib/agent.js

Я адресовал их разработчику: https://github.com/elastic/apm-agent-nodejs/issues/1154

...