У меня есть проект Preact (preact-cli
), основанный на preact create default
.
При добавлении react-ga
(Google Analytics) я получаю эту ошибку сборки:
✖ ERROR ../node_modules/react-ga/dist/esm/components/OutboundLink.js
Module not found: Error: Can't resolve 'react' in './node_modules/react-ga/dist/esm/components'
@ ../node_modules/react-ga/dist/esm/components/OutboundLink.js 169:0-41 239:13-18 244:2-11
@ ../node_modules/react-ga/dist/esm/index.js
@ ./components/app.js
@ ./index.js
@ ../node_modules/preact-cli/lib/lib/entry.js
@ multi ../node_modules/preact-cli/lib/lib/entry webpack-dev-server/client webpack/hot/dev-server
I Я использую конфигурацию по умолчанию (без пользовательских preact.config.js
), поэтому вывод config.resolve.alias
:
{
style: 'MYPROJECT/src/style',
'preact-cli-entrypoint': 'MYPROJECT/src/index',
react: 'preact-compat',
'react-dom': 'preact-compat',
'react-addons-css-transition-group': 'preact-css-transition-group',
'preact-cli/async-component': 'MYPROJECT/node_modules/@preact/async-loader/async.js'
}
Любые советы?
Обновление: вывод npm ls | grep preact
:
├─┬ enzyme-adapter-preact-pure@2.2.0
│ └─┬ preact-render-to-string@4.1.0
├─┬ eslint-config-preact@1.1.0
├─┬ jest-preset-preact@1.0.0
├── UNMET PEER DEPENDENCY preact@10.3.4
├─┬ preact-cli@3.0.0-rc.10
npm ERR!│ ├─┬ @preact/async-loader@3.0.0-rc.9
peer dep missing: preact@^8.1.0, required by preact-render-spy@1.3.0
npm ERR! peer dep missing: react@^15.6.2 || ^16.0, required by react-ga@2.7.0
npm ERR! peer dep missing: webpack@4.28.4, required by babel-esm-plugin@0.7.1
npm ERR! peer dep missing: preact@^8.1.0, required by @preact/async-loader@3.0.0-rc.9
npm ERR! peer dep missing: @types/react@^15.0.0 || ^16.0.0, required by react-hot-loader@4.12.20
npm ERR! peer dep missing: react@^15.0.0 || ^16.0.0, required by react-hot-loader@4.12.20
npm ERR! peer dep missing: react-dom@^15.0.0 || ^16.0.0, required by react-hot-loader@4.12.20
│ ├── UNMET PEER DEPENDENCY preact@^8.1.0
├─┬ preact-helmet@4.0.0-alpha-3
│ └── preact-side-effect@1.3.0
├─┬ preact-render-spy@1.3.0
│ └─┬ preact-render-to-string@3.8.2
├─┬ preact-render-to-string@5.1.4
├── preact-router@3.2.1