title: Import moment.js in js file in webpack
body: <p>In my project I use webpack and npm. I installed moment.js : <code>npm install moment</code>. Then I want to import it in my app.js file: <code>import moment from "moment"</code>. </p>
  
  <p>But it doesn't work. I get: <em>Can't resolve moment in ...</em></p>
  
  <p>I try <code>let moment = require('moment');</code>but I get the same error.</p>
  
  <p>But I can require it in my webpack.config.js file without errors.</p>
  
  <p>My app.js file is located on <code>/myapp/frontend/app.js</code></p>
  
  <p>My webpack.config.js file on:<code>/myapp/webpack.config.js</code></p>
  
  <p>So, please explain why I can't require moment in my app.js and how can I do this?</p>
  
  <p>My config file:</p>
  
  <pre><code>const webpack = require("webpack");
  const NODE_ENV = process.env.NODE_ENV || "development"
  const path = require('path');
  
  //example of successfull importing
  let moment = require('moment');
  console.log(moment(new Date()));
  
  module.exports = {
      context: __dirname + "/frontend",
      entry: {
          app:"./app"
      },
      output: {
          path: path.resolve(__dirname,"./public/js"),
          publicPath:"/public/js/",//public path in internet
          filename: "build.js"
      },
  
      watch: NODE_ENV == "development",
      watchOptions:{
          aggregateTimeout:100//default = 300
      },
      devtool: NODE_ENV == "development"?"cheap-inline-module-source-map":"cheap-source-map",
                                        //cheap-inline-module-source-map - to see sources in build.js
                                        //eval - fastest
  
      resolve:{
          modules: ['node-modules'],
          extensions:['.js']
      },
      module:{
          loaders:[{
              test: /\.js$/,
              loader:"babel-loader?presets[]=es2015",
              exclude: /node_modules/
          }]
      }
  };
  
  if(NODE_ENV == "production"){
      module.exports.plugins.push(
          new webpack.optimize.UglifyJsPlugin({
              compress:{
                  warnings:false,
                  unsafe:true,
                  drop_console:true
              }
          })
      );
  }
  </code></pre>
  
  <p>It is my tree structure without node_modules folder:</p>
  
  <h2><a href="https://i.stack.imgur.com/GYuPy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GYuPy.png" alt="It is my tree structure without node_modules folder"></a></h2>
  
  <p><strong>SOLVING OF PROBLEM</strong>: problem was in my configuration:</p>
  
  <pre><code>  resolve:{
              modules: ['node-modules'],
              extensions:['.js']
          },
  </code></pre>
  
  <p>There is <code>node-modules</code> is wrong, must be <code>node_modules</code>. Simple typo..</p>