-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
98 lines (92 loc) · 2.4 KB
/
webpack.dev.js
File metadata and controls
98 lines (92 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var parseArgs = require('minimist');
var Argv = parseArgs(process.argv);
var modulesPaths = [Argv.srcDirectory];
try {
fs.lstatSync(Argv.srcDirectory + '/common');
modulesPaths.push(fs.realpathSync(Argv.srcDirectory + '/common'));
} catch (error) {
console.info('No code symlink ... skipping');
}
module.exports = {
entry: [
__dirname + '/node_modules/webpack-dev-server/client?http://localhost:8080',
__dirname + '/node_modules/webpack/hot/only-dev-server',
Argv.entryPoint
],
output: {
publicPath: '/',
path: path.resolve(Argv.entryPoint, 'build'),
filename: 'bundle.js'
},
devtool: 'source-map',
resolve: {
fallback: path.join(process.cwd(), 'node_modules')
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
},
module: {
loaders: [
{
test: /\.woff$/,
loader: 'url?limit=100000',
include: modulesPaths
},
{
test: /\.css$/,
loader: 'style!css',
include: modulesPaths
},
{
test: /\.less$/,
loader: 'style!css!less',
include: modulesPaths
},
{
test: /\.jsx?/,
loader: 'babel-loader',
query: {
presets: [
require.resolve('babel-preset-react-hmre'),
require.resolve('babel-preset-es2015'),
require.resolve('babel-preset-react'),
require.resolve('babel-preset-stage-0')
],
plugins: [
require.resolve('babel-plugin-typecheck')
]
},
include: modulesPaths
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file',
include: modulesPaths
}
]
},
plugins: [
new webpack.DefinePlugin({
__DEV__ : (process.env.NODE_ENV !== 'production'),
__VERSION__ : JSON.stringify(require(Argv.srcDirectory + '/../package.json').version)
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new HtmlWebpackPlugin({
title: 'λ Lambda Dev Server',
template: path.join(Argv.srcDirectory, '/index.tpl.html')
})
],
devServer: {
contentBase: Argv.srcDirectory + '/../build/',
host: 'localhost',
port: 8080,
hot: true,
historyApiFallback: true,
colors: true
}
};