title: Docker node build - babel preset and deep module errors
body: <p>After resolving several extra babel presets required (to what my npm scripts built), then an <code>unknown plugin "add-module-exports" in /node_modules/react-dropzone/.babelrc</code>, I'm now encountered a requirement to <code>npm rebuild node-sass --force</code></p>
  
  <p>Also, webpack is taking a long time build, 3-4min.</p>
  
  <p>I have a feeling either my node_module folder or the environment isnt setup properly here. Is my current setup doing something silly that I'm missing?</p>
  
  <p>.babelrc</p>
  
  <pre><code>{
    "compact": false,
    "presets": [
      "es2015",
      "es2015-loose",
      "stage-2",
      "stage-1",
      "stage-0",
      "react"
    ],
    "env": {
      "test": {
        "plugins": ["transform-es2015-modules-commonjs"]
      }
    }
  }
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM node:7.7.3
  
  RUN npm install -g pm2 babel-cli
  
  # Useful for reloading npm install if package json changed
  ADD package.json /tmp/package.json
  RUN cd /tmp &amp;&amp; npm install
  RUN mkdir -p /usr/src/app &amp;&amp; cp -a /tmp/node_modules /usr/src/app
  
  COPY . /usr/src/app
  WORKDIR /usr/src/app
  ADD .babelrc server.js index.js /usr/src/app/
  
  CMD ["pm2", "start", "./index.js", "--no-daemon"]
  EXPOSE 2020
  </code></pre>
  
  <p>docker-compose.yml</p>
  
  <pre><code>doc:
    build: .
    ports:
      - "2020:2020"
    volumes:
      - .:/usr/src/app/
      - /usr/src/app/node_modules
  </code></pre>
  
  <p>./index.js</p>
  
  <pre><code>require('babel-register');
  require('./server.js');
  </code></pre>
  
  <p>./server.js</p>
  
  <pre><code>var express = require('express');
  var path = require('path');
  
  const isDeveloping = process.env.NODE_ENV !== 'production';
  const PORT = isDeveloping ? 2020 : 2020; // process.env.PORT - docker?
  const app = express();
  
  
  if (isDeveloping) {
    let webpack = require('webpack');
    let webpackMiddleware = require('webpack-dev-middleware');
    let webpackHotMiddleware = require('webpack-hot-middleware');
    let config = require('./webpack.prod.config.js');
    const compiler = webpack(config);
    const middleware = webpackMiddleware(compiler, {
    publicPath: config.output.publicPath,
      noInfo: true,
      quiet: false,
      lazy: false,
      watchOptions: {
       aggregateTimeout: 300,
       poll: true
     },
     stats: {
      colors: true,
     }
   });
  
  const bundlePath = path.join(__dirname, './dist/index.html');
  
  app.use(middleware);
  app.use(webpackHotMiddleware(compiler));
  app.get('*', function response(req, res) {
  res.write(middleware.fileSystem.readFileSync(bundlePath));
  res.end();
  });
  
   } else {
     console.log(process.env.NODE_ENV)
     const staticPath = path.join(__dirname, 'dist')
     app.use(express.static(staticPath));
   }
  
   app.listen(PORT)
   console.log('Open up http://localhost:' + PORT);
  </code></pre>