1.0.3 • Published 3 years ago

@jswork/next-try-require v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

next-try-require

Check if a dependency exists with webpack

version license size download

installation

npm install -S @jswork/next-try-require

usage

└── medias
    ├── animation.tsx
    ├── audio.tsx
    ├── document.tsx
    ├── image.tsx
    ├── unknown.tsx
    └── video.tsx
import '@jswork/next-try-require';

// .${context}${path}
// .${context}${defaults}
// @${context}${path}
// @${context}${defaults}

const MediaComponent = nx.tryRequire(
  mediaType,
  'unknown',
  { context: '/medias/'}
);

<MediaComponent model={model}/>

license

Code released under the MIT license.