is resolve.root working in webpack 2.1.0-beta.4?

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

Author: Fantashit

1 thought on “is resolve.root working in webpack 2.1.0-beta.4?

Comments are closed.