require.extensions


    指导 require 如何处理某些文件扩展名。

    Stability: 0 - Deprecated

    Instruct require on how to handle certain file extensions.

    Process files with the extension .sjs as .js:

    require.extensions['.sjs'] = require.extensions['.js'];

    Deprecated. In the past, this list has been used to load non-JavaScript modules into Node.js by compiling them on-demand. However, in practice, there are much better ways to do this, such as loading modules via some other Node.js program, or compiling them to JavaScript ahead of time.

    Avoid using require.extensions. Use could cause subtle bugs and resolving the extensions gets slower with each registered extension.