Pulse7
9/6/2017 - 11:32 AM

Setup webconfig

webpack will not create physical bundle.js in this case also notice import css file in javascript

import './index.css';
import numeral from 'numeral';

const courseValue = numeral(1000).format('$0,0.00');
console.log(`I would pay ${courseValue} for this awesome course!`);
import express  from "express";
import path from "path";
import open from "open";

//webpack
import webpack from 'webpack';
import config from '../webpack.config.dev';

var port = 3000;
var app = express();

//webpack
const compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler,{
  noInfo:true,
  publicPath: config.output.publicPath

}));

app.get('/', function (req, res) {
  res.sendFile(path.join(__dirname, '../src/index.html'))
});

app.listen(port,function(err){
  if(err){
    console.log(err);
  } else{
    open('http://localhost:'+port);
  }
});
"devDependencies"{
  "style-loader": "0.13.1",
    "webpack": "1.13.2",
    "webpack-dev-middleware": "1.8.4",
    "webpack-hot-middleware": "2.13.0",
    "webpack-md5-hash": "0.0.5"
}
import path from 'path';

export default {
  debug: true,
  devtool: 'inline-source-map',
  noInfo: false,
  entry: [
    path.resolve(__dirname, 'src/index')
  ],
  target: 'web',
  output: {
    path: path.resolve(__dirname, 'src'),
    filename: 'bundle.js'
  },
  plugins: [],
  module: {
    loaders: [
      {test: /\.js$/, exclude: /node_modules/, loaders: ['babel']},
      {test: /\.css$/, loaders: ['style','css']}
    ]
  }
}
body{
  font-family: sans-serif;
}

table th{
  padding: 5px;
}