webpack-local-libs
Utilities for getting webpack to resolve/alias packages from local paths relative to the current directory
Installation
Requires nodejs.
$ npm install webpack-local-libs
Examples
// webpack.config.js var getWebpackLocalLibEnhancer = ; var localLibMap = 'js': 'libraryA': '../someDir/someDir2' 'libraryB': '../../anotherDir/mainFile.js' 'css': 'libraryC': '../assetDir' var localLibsEnabled = processenvNODE_ENV !== 'production'; var webpackLocalLibEnhancer = ; Note: for Webpack 2 support you can use the following: var webpackLocalLibEnhancer = ; moduleexports = // creates the resolve object for you (existing aliases are preserved unless they are overriden): // { alias: { // libraryA: path.resolve(__dirname, '../someDir/someDir2'), // libraryB: path.resolve(__dirname, '../../anotherDir/mainFile.js'), // libraryC: path.resolve(__dirname, '../assetDir') // } } // Note that webpackLocalLibEnhancer.enhanceResolveRootAndAlias() exists for convenience resolve: webpackLocalLibEnhancer // existing resolve argument can be ommitted // creates the resolveLoader object for you: // { root: path.join(__dirname, 'node_modules') }; resolveLoader: webpackLocalLibEnhancer // existing resolveLoader argument can be ommitted // creates include entries for you (removes filenames if they exist at the end): // { include: [ // path.resolve(__dirname, 'src'), // path.resolve(__dirname, '../someDir/someDir2'), // path.resolve(__dirname, '../../anotherDir') // ]} module: loaders: test: /\.js$/ loaders: 'babel' include: webpackLocalLibEnhancer test: /\.css$/ loader: ExtractTextPlugin include: webpackLocalLibEnhancer ;