-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
executable file
·56 lines (51 loc) · 1.72 KB
/
webpack.config.js
File metadata and controls
executable file
·56 lines (51 loc) · 1.72 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
// You shouldn't have to touch this webpack file.
// Webpack is a module bundler, which means it takes modules with dependencies
// and packages them into one bundle file. In this configuration, it also uses
// babel to transpile the files before bundling. Webpack knows which files to include
// by starting with the 'entry' file in the config, and following the es6 import
// statements.
var webpack = require('webpack');
var path = require('path');
// Build directory is where the bundle file will be placed
var BUILD_DIR = path.resolve(__dirname, 'client/');
// App directory is where all of your raw JSX files will be placed
var APP_DIR = path.resolve(__dirname, 'client/src');
// The files in the app directory will get transpiled and packaged into one
// file, bundle.js, which will get saved in the BUILD_DIR.
// If you use the `npm run dev-react`, webpack will generate source maps and
// watch your files for changes.
// While developing your app in react, you'll want to have two terminal tabs open -
// one that is running `npm run dev-react` and one that is running `npm start`
var config = {
entry: APP_DIR + '/index.js',
module: {
loaders: [
// {
// test: /\.jsx?/,
// include: APP_DIR,
// loader: 'babel',
// query: {
// presets: ['es2015', 'react']
// }
// },
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015'],
plugins: ['transform-class-properties']
}
}
]
},
output: {
path: BUILD_DIR,
filename: 'bundle.js'
}
};
module.exports = config;