Running Webpack on c9


#1

Hello guys,

I am having the following webpack.config.js:

const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  entry: [
    'webpack-dev-server/client?https://0.0.0.0:8080',
    'webpack/hot/dev-server',
    './app/javascripts/app.js'
  ],
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: 'app.js'
  },
  plugins: [
    // Copy our app's index.html to the build folder.
    new CopyWebpackPlugin([{
      from: './app/index.html',
      to: 'index.html'
    }])
  ],
  module: {
    rules: [{
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      },
      {
        test: /\.scss$/,
        use: ['style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
      },
      {
        test: /\.woff2?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        use: 'url-loader?limit=10000'
      },
      {
        test: /\.(ttf|eot|svg)(\?[\s\S]+)?$/,
        use: 'file-loader'
      }
    ],
    loaders: [{
        test: /\.json$/,
        use: 'json-loader'
      },
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        loader: 'babel-loader',
        query: {
          presets: ['es2015'],
          plugins: ['transform-runtime']
        }
      }
    ]
  }
}

Within my package.json file I have the following scripts:

  "scripts": {
    "lint": "eslint ./",
    "build": "webpack",
    "dev": "webpack-dev-server"
  },

When I run npm run dev everything outputs correctly:

npm run dev

> demo_application@ dev /home/ubuntu/workspace
> webpack-dev-server

Project is running at http://localhost:8080/
webpack output is served from /
Hash: d8911ef6d1af367abcb2
Version: webpack 2.7.0
Time: 5858ms
                                 Asset     Size  Chunks                    Chunk Names
  f4769f9bdb7466be65088239c12046d1.eot  20.1 kB          [emitted]         
  89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]         
  e18bbf611f2a2e43afc071aa2f4e1512.ttf  45.4 kB          [emitted]         
 fa2772327f55d8198301fdb8bcfc8158.woff  23.4 kB          [emitted]         
448c34a56d699c29117adc64c43affeb.woff2    18 kB          [emitted]         
                                app.js  1.91 MB       0  [emitted]  [big]  main
                            index.html  3.27 kB          [emitted]         
chunk    {0} app.js (main) 1.88 MB [entry] [rendered]
   [62] ./~/strip-ansi/index.js 161 bytes {0} [built]
   [71] ./~/url/url.js 23.3 kB {0} [built]
   [75] (webpack)-dev-server/client/overlay.js 3.67 kB {0} [built]
   [76] (webpack)-dev-server/client/socket.js 1.08 kB {0} [built]
   [77] (webpack)/hot nonrecursive ^\.\/log$ 160 bytes {0} [built]
   [78] (webpack)/hot/emitter.js 77 bytes {0} [built]
   [80] ./app/javascripts/app.js 2.97 kB {0} [built]
   [81] (webpack)-dev-server/client?http://localhost:8080 7.91 kB {0} [built]
   [82] (webpack)-dev-server/client?https://0.0.0.0:8080 7.91 kB {0} [built]
   [83] (webpack)/hot/dev-server.js 1.57 kB {0} [built]
   [84] ./build/contracts/CryptoValentine.json 25.2 kB {0} [built]
  [134] ./app/stylesheets/app.css 905 bytes {0} [built]
  [135] ./~/bootstrap/dist/css/bootstrap.css 883 bytes {0} [built]
  [176] ./~/truffle-contract/index.js 2.64 kB {0} [built]
  [247] multi (webpack)-dev-server/client?http://localhost:8080 webpack-dev-server/client?https://0.0.0.0:8080 webpack/hot/dev-server ./app/javascripts/app.js 64 bytes {0} [built]
     + 233 hidden modules
webpack: Compiled successfully.

However, I cannot access the application page.

Any suggestions what I am doing wrong?

I appreciate your replies!