@elastic/webpack-directory-name-as-main

Teach webpack to use the name of the directory as the main file for a module

Stats

StarsIssuesVersionUpdatedCreatedSize
@elastic/webpack-directory-name-as-main
402.0.34 years ago5 years agoMinified + gzip package size for @elastic/webpack-directory-name-as-main in KB

Readme

@elastic/webpack-directory-name-as-main

Teach webpack to use a file with the same name as the directory if that directory is required and it doesn't have an index.js file.

This allows you to write:

require('lib/ReallyImportantModule')

inorder to require:

lib/ReallyImportantModule/ReallyImportantModule.js

This module is designed to be used as strategy for a webpack.ResolverPlugin like so:

var DirectoryNameAsMain = require('@elastic/webpack-directory-name-as-main');
var webpackConfig = {
  entry: ...,

  plugins: [
    new webpack.ResolverPlugin([
      new DirectoryNameAsMain()
    ]),
    ...
  ]
};

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.