Hi, here is my webpack config:
var path = require('path');
module.exports = {
context: __dirname + '/src',
entry: './main',
output: {
path: __dirname + '/dist',
filename: 'bundle.js'
},
devtool: 'cheap-eval-source-map',
module: {
loaders: [
{
test: /\.hbs$/,
loader: ['handlebars']
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015']
}
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
}
]
},
resolve: {
root: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules')
],
extensions: ['', '.js']
}
};
and my directory structure:
dist
node_modules
src
--components
----Document
------Document.js
--constants
--templates
--utils
--main.js
index.html
package.json
webpack.config.js
when I do something like import Document from 'components/Document/Document.js';
and webpack, i get the following:
ERROR in ./main.js
Module not found: Error: Can't resolve 'components/Document/Document.js' in '/Users/davis/workspace/project/src'
@ ./main.js 5:16-58
nope. It was merged into
resolve.modules
. https://gist.github.com/sokra/27b24881210b56bbaff7#resolving-options