webpack-require-weak

1.0.1 • Public • Published

webpack-require-weak

Require a webpack resolveWeak id

const isWebpackBundle = require('is-webpack-bundle');
const webpackRequireWeak = require('webpack-require-weak');

let myModule;

if (isWebpackBundle) {
  myModule = webpackRequireWeak(require.resolveWeak('./path/to/module'));
} else {
  myModule = require('./path/to/module');
}

Readme

Keywords

none

Package Sidebar

Install

npm i webpack-require-weak

Weekly Downloads

1,245

Version

1.0.1

License

MIT

Last publish

Collaborators

  • thejameskyle