# Installing your own dependencies via NPM

**URL:** <https://forum.shopware.com/t/installing-your-own-dependencies-via-npm/91260>\
**Category:** Shopware 6 (English)\
**Created:** [3. November 2021 um 08:48 UTC](https://forum.shopware.com/t/installing-your-own-dependencies-via-npm/91260 "2021-11-03T08:48:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [3. November 2021 um 08:48 UTC](https://forum.shopware.com/t/installing-your-own-dependencies-via-npm/91260/1 "2021-11-03T08:48:06Z")

</div>

Hi again!  
Another question about ShopWare6.  
I try to install some dependencies via NPM to my Shopware. I use this instruction:  
[https://www.shopware.com/en/news/installing-your-own-dependencies-via-npm/](https://www.shopware.com/en/news/installing-your-own-dependencies-via-npm/)  
and it works with „missionlog“ module.  
I wish to install swiper from [https://swiperjs.com/](https://swiperjs.com/). My steps:

1. Go to /src/Resources/app/storefront
2. Run: npm init -y
3. Installing the package: npm install --save swiper
4. Create file: /src/Resources/app/storefront/build/webpack.config.js with content:

```auto
const { join, resolve } = require('path'); 
module.exports = () => { 
    return { 
        resolve: { 
            alias: { 
                '@swiper': resolve( 
                    join(__dirname, '..', 'node_modules', 'swiper') 
                ) 
            } 
        }
   }; 
}

```

1. In my js file import swiper:

```auto
import Plugin from 'src/plugin-system/plugin.class';
import { Swiper } from '@swiper';

```

1. Run: ./psh.phar storefront:build from my root directory.

But after that I got errors:

> Module not found: Error: Can’t resolve ‚dom7‘ in '/src/Resources/app/storefront/node\_modules/swiper/shared  
> and  
> Module not found: Error: Can’t resolve ‚ssr-window‘ in ‚/src/Resources/app/storefront/node\_modules/swiper/core‘  
> Second one repeats 21 times with different files and pathes from /swiper/ dir.

Thanks a lot for any help!

---

<div class="post-metadata">

**Author:** ![yannickdev](https://avatars.discourse-cdn.com/v4/letter/y/b2d939/32.png) [@yannickdev](https://forum.shopware.com/u/yannickdev)\
**Post date:** [17. Oktober 2022 um 15:23 UTC](https://forum.shopware.com/t/installing-your-own-dependencies-via-npm/91260/2 "2022-10-17T15:23:00Z")

</div>

It seems Shopware 6 struggles to resolve sub dependencies. Both of these packages are dependencies of swiper. Probably not the best solution, but i added a resolver for the sub dependencies and that works for me with version 6.4.13.0.

````auto
module.exports = () => {
  return {
    resolve: {
      alias: {
        "@swiper": path.resolve(
          path.join(__dirname, "..", "node_modules", "swiper")
        ),
        "dom7": path.resolve(path.join(__dirname, "..", "node_modules", "dom7")),
        "ssr-window": path.resolve(
          path.join(__dirname, "..", "node_modules", "ssr-window")
        ),
      },
    },
  };
};```
````

---

<div class="post-metadata">

**Author:** ![yurii.k](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yurii.k](https://forum.shopware.com/u/yurii.k)\
**Post date:** [24. Oktober 2022 um 06:31 UTC](https://forum.shopware.com/t/installing-your-own-dependencies-via-npm/91260/3 "2022-10-24T06:31:05Z")

</div>

Nice idea, thank you!
