-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.js
35 lines (34 loc) · 1.32 KB
/
webpack.config.js
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
const path = require('path'); // import Node.js path module for path related operations
// create our config object
const config = {
entry: path.join(__dirname, '/client/index.js'), // Abosolute path to our entry file
output: { // our output configuration
path: path.join(__dirname, './public/'), // output path (directory/folder)
filename: 'bundle.js' // output bundled file name
},
module: { // define our loaders here
// array of rules to handle different file types
rules: [
{
test: /\.(js|jsx)$/, // check for .js and .jsx files (uses Regex)
loader: 'babel-loader' // use this loader for .js and .jsx files found
},
{
// check for files ending with .css (uses Regex)
test: /\.css$/,
// use these loaders of .css files. 'css-loader gets run first and is
// used to handle the imports of our css files inside our jsx files.
// The style loader then mounts our css in to the DOM
loaders: ['style-loader', 'css-loader']
}
]
},
// set the file extensions we want webpack to resolve
resolve: {
extensions: ['.js', '.jsx']
}
};
// export our config object.
// You may have noticed we are using es5 syntax here. This is because Webpack, which would be using this
// file, expects es5 syntax
module.exports = config;