1.0.3 • Published 3 years ago
@jswork/next-try-require v1.0.3
next-try-require
Check if a dependency exists with webpack
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.