2016-09-21 00:58:31 +08:00
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const PATH_ESLINT = path.join(__dirname, '.eslintrc.js');
|
2016-09-21 03:25:42 +08:00
|
|
|
const PATH_SRC = path.join(__dirname, 'src');
|
2016-09-21 00:58:31 +08:00
|
|
|
|
2016-11-17 04:02:24 +08:00
|
|
|
module.exports = {
|
2016-09-21 00:58:31 +08:00
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
2016-11-17 04:02:24 +08:00
|
|
|
'test': PATH_SRC
|
2016-09-21 00:58:31 +08:00
|
|
|
},
|
|
|
|
devServer: {
|
|
|
|
inline: true,
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'dist'),
|
|
|
|
filename: '[name].bundle.js',
|
|
|
|
},
|
|
|
|
eslint: {
|
|
|
|
configFile: PATH_ESLINT,
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.(js|jsx)$/,
|
|
|
|
include: [PATH_SRC],
|
|
|
|
exclude: [],
|
|
|
|
loader: "babel-loader",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
preLoaders: [ { test: /\.js$/, include: [PATH_SRC], loader: 'eslint-loader' } ]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['', '.js', '.json', '.jsx'],
|
2016-09-21 03:25:42 +08:00
|
|
|
alias: [
|
|
|
|
{ 'shell-game': PATH_SRC }
|
|
|
|
],
|
2016-09-21 00:58:31 +08:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
function () {
|
|
|
|
this.plugin('done', () =>
|
|
|
|
setTimeout(() => console.log('\nFinished at ' + (new Date).toLocaleTimeString() + '\n'), 10)
|
|
|
|
);
|
|
|
|
},
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
]
|
2016-11-17 04:02:24 +08:00
|
|
|
};
|