Giter Site home page Giter Site logo

enhanced-resolve's Introduction

enhanced-resolve

Offers a async require.resolve function. It's highly configurable.

Features

  • plugin system
  • provide a custom filesystem
  • sync and async node.js filesystems included

Tests

npm test

Build Status

Contributing

Take a look at lib/ResolveFactory.js to understand how everything fits together. It provides a createResolver(options) function and these are the possible options:

Field Default Description
modules ["node_modules"] A list of directories to resolve modules from, can be absolute path or folder name
descriptionFiles ["package.json"] A list of description files to read from
plugins [] A list of additional resolve plugins which should be applied
mainFields ["main"] A list of main fields in description files
aliasFields [] A list of alias fields in description files
mainFiles ["index"] A list of main files in directories
extensions [".js", ".json", ".node"] A list of extensions which should be tried for files
enforceExtension false Enforce that a extension from extensions must be used
moduleExtensions [] A list of module extsions which should be tried for modules
enforceModuleExtension false Enforce that a extension from moduleExtensions must be used
alias [] A list of module alias configurations or an object which maps key to value
resolveToContext false Resolve to a context instead of a file
unsafeCache false Use this cache object to unsafely cache the successful requests
cachePredicate function() { return true }; A function which decides wheter a request should be cached or not. An object is passed to the function with path and request properties.
fileSystem The file system which should be used
resolver undefined A prepared Resolver to which the plugins are attached

The options are passed from the revolve key of your webpack configuration e.g.:

resolve: {
  extensions: ['', '.js', '.jsx'],
  modules: ['src', 'node_modules'],
  plugins: [new DirectoryNamedWebpackPlugin()]
  ...
},

License

Copyright (c) 2012-2016 Tobias Koppers

MIT (http://www.opensource.org/licenses/mit-license.php)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.