I'd like to load modules using just a folder name, without specifying file name in that specific folder. Like it's done here in react-starter-kit:
I imagine that this is needed to be done in Webpack configuration, but I cannot wrap my head around that yet (I'm fresh to javascript).
My app is structured this way atm and I have to reference both folder and file name in order to import it.
That's my current webpack.config.js:
const webpack = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
const htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: '#cheap-module-eval-source-map',
entry: [
'webpack-hot-middleware/client',
'tether',
'font-awesome-loader',
'bootstrap-loader',
'./app/App',
],
output: {
path: path.join(__dirname, 'public'),
filename: 'app.js',
publicPath: '/',
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react', 'stage-0']
}
}, {
test: /\.css$/,
loaders: [
'style',
'css?modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]',
'postcss'
]
}, {
test: /\.scss$/,
loaders: [
'style',
'css?modules&importLoaders=2&localIdentName=[name]__[local]__[hash:base64:5]',
'postcss',
'sass'
]
}, {
test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url?limit=10000"
}, {
test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
loader: 'file'
}]
},
postcss: [autoprefixer],
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new htmlWebpackPlugin({
title: 'MoiApp'
}),
new webpack.ProvidePlugin({
"window.Tether": "tether"
})
]
};
However I could not find anything useful on Google. Perhaps I'm making my query not correct enough. Please advice on how to achieve that.