# Can't resolve 'deepmerge' - Entwicklung mit Symfony Flex

**URL:** <https://forum.shopware.com/t/cant-resolve-deepmerge-entwicklung-mit-symfony-flex/97154>\
**Category:** Shopware 6 (German)\
**Created:** [17. November 2022 um 14:54 UTC](https://forum.shopware.com/t/cant-resolve-deepmerge-entwicklung-mit-symfony-flex/97154 "2022-11-17T14:54:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![littleAmused](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/littleamused/32/13261_2.png) [@littleAmused](https://forum.shopware.com/u/littleAmused)\
**Post date:** [17. November 2022 um 14:54 UTC](https://forum.shopware.com/t/cant-resolve-deepmerge-entwicklung-mit-symfony-flex/97154/1 "2022-11-17T14:54:24Z")

</div>

Moin mal wieder ans Forum!

Ich habe mich mal mit der lokalen Entwicklung via Symfony Flex befasst - soweit ganz angenehm, wenn auch etwas lückenhaft erklärt in der Anleitung… Einige Informationen muss man sich zusammensuchen, z.B. wie man Demo-Daten richtig installiert, oder man bei dem `system:install` Befehl auch den Parameter `--create-database` nutzen kann, um eine DB automatisch durch Symfony erstellen zu lassen… und, dass man sich zusätzlich auch die PSH-Library noch vom Repository ziehen sollte ([GitHub - shopwareLabs/psh: PSH - PHP shell helper](https://github.com/shopwareLabs/psh)) … Das aber nur als kleine Randnotiz 🙂

Ich hab nun beim Kompilieren des Storefronts das Problem, dass das NPM Package „deepmerge“ nicht erkannt wird. Der Error sieht wie folgt aus:

```auto
ERROR in ./plugin-system/plugin.manager.js
Module not found: Error: Can't resolve 'deepmerge' in '/My/Local/Machine/shopware-flex/vendor/shopware/storefront/Resources/app/storefront/src/plugin-system'

```

Der Fehler wird noch für ein paar JS-Plugins (Listing, Slider, Cms-Slot-Reload) wiederholt, letztendlich kann ich dadurch aber das JS nicht kompilieren, das ich für die Entwicklung unserer eigenen Plugins und Themes nutzen möchte.  
Ich habe bereits versucht, npm install im betroffenen Verzeichnis auszuführen, um ggf. fehlende Pakete zu installieren, das schien jedoch nicht die Ursache des Fehlers zu sein - Deepmerge ist im node\_modules-Verzeichnis vorhanden, nur der Import klappt wohl irgendwie nicht.

Ich hab überlegt, ob man in der Datei webpack.conig.js einfach ein Alias hinzufügen könnte, hatte bisher aber leider keinen Erfolg…

Kann da jemand helfen, oder hat eine Idee?

LG;LA

---

<div class="post-metadata">

**Author:** ![littleAmused](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/littleamused/32/13261_2.png) [@littleAmused](https://forum.shopware.com/u/littleAmused)\
**Post date:** [18. November 2022 um 10:36 UTC](https://forum.shopware.com/t/cant-resolve-deepmerge-entwicklung-mit-symfony-flex/97154/2 "2022-11-18T10:36:34Z")

</div>

**Temporärer Fix**  
(nicht updatesicher, für die lokale Enticklung als Workaround aber erstmal ausreichend)

> <https://github.com/TehShrike/deepmerge/issues/87#issuecomment-369646724>
>
> When importing deepmerge with \`import \* as merge from 'deepmerge';\` throws \`Erro…r: merge is not a function\` in the app, while the tests run just fine.
> 
> When importing with \`import merge from \`deepmerge;\`, the app works fine, but the jest tests throw \`TypeError: deepmerge\_1.default is not a function\`.
> 
> I have temporarily patched the issue in my code with an \`if/else\` block to reassign the correct function to the variable, but I feel there must be a better way.
> 
> Maybe jest is misconfigured. Has anyone ever encountered a similar issue or can provide a configuration template that is proven to be working?
> 
> This describes a similar issue to what I am experiencing https://github.com/aurelia/skeleton-navigation/issues/606, though I am not using Aurelia, nor Moment. It just seems like the same \_kind\_ of problem.
> 
> \--------
> 
> \*\*Node version\*\*: 8.6.0
> \*\*NPM version\*\*: 5.5.1
> \*\*Webpack version\*\*: 3.6.0
> \*\*Typescript version\*\*: 2.5.3
> \*\*deepmerge version\*\*: 2.0.1
> 
> \-------
> 
> tsconfig.json
> 
> \`\`\`javascript
> {
> "compilerOptions": {
> "outDir": "./dist/",
> "sourceMap": true,
> "noImplicitAny": false,
> "module": "commonjs",
> "target": "es5",
> "lib": \["es7", "es2017", "dom"\],
> "jsx": "preserve",
> "allowJs": true
> },
> "include": \["src/\*\*/\*"\],
> "exclude": \["node\_modules", "\*\*/\*.test.ts"\]
> }
> \`\`\`
> 
> \-------
> 
> .babelrc
> 
> \`\`\`javascript
> {
> "presets": \["env", "react"\],
> "plugins": \[
> "react-css-modules"
> \]
> }
> \`\`\`
> 
> \-------
> 
> jest.config.json
> 
> \`\`\`javascript
> {
> "transform": {
> ".(ts|tsx)": "\<rootDir\>/node\_modules/ts-jest/preprocessor.js"
> },
> "testRegex": "(/\_\_tests\_\_/.\*|\\\\.(test|spec))\\\\.(ts|tsx|js)$",
> "moduleFileExtensions": \["ts", "tsx", "js", "jsx", "json"\]
> }
> \`\`\`

In der Datei `/vendor/shopware/storefront/Resources/app/storefront/webpack.config.js` folgenden Alias hinzufügen:

```auto
deepmerge$: path.resolve(__dirname, 'node_modules/deepmerge/dist/umd.js')

```
