| 1 |
// node module that let's us do file system stuffs... |
| 2 |
const path = require('path'); |
| 3 |
|
| 4 |
// Webpack expects an exported object with all the configurations, so we export an object here |
| 5 |
module.exports = { |
| 6 |
entry: './src/index.js', // Where to find our main js |
| 7 |
output: { |
| 8 |
// where we want our built file to go to and be named |
| 9 |
// I name it index.build.js so I keep index files separate |
| 10 |
filename: 'index.build.js', |
| 11 |
// we're going to put our built file in a './build/' folder |
| 12 |
path: path.resolve(__dirname, 'build') |
| 13 |
}, |
| 14 |
module: { |
| 15 |
rules: [ |
| 16 |
{ |
| 17 |
// basically tells webpack to use babel with the correct presets |
| 18 |
test: /\.js$/, |
| 19 |
loader: 'babel-loader', |
| 20 |
query: { |
| 21 |
presets: ['@babel/preset-env', '@babel/preset-react'] |
| 22 |
} |
| 23 |
} |
| 24 |
] |
| 25 |
}, |
| 26 |
// Webpack yells at you if you don't choose a mode... |
| 27 |
mode: 'development' |
| 28 |
} |