npm install webpack -g
npm install --save-dev webpack
npm install babel-preset-react
npm install babel-preset-es2015
sample package.json
{
"name": "todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Marcus Shepherd",
"license": "ISC",
"dependencies": {
"react": "^15.3.1",
"react-dom": "^15.3.1"
},
"devDependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"webpack": "^1.13.2"
}
}
in webpack.config.js
...
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel",
query: {
presets: ["es2015", "react"]
}
}
]
}
...
https://www.youtube.com/watch?v=MzVFrIAwwS8
The bundler of all things.
- modules hidden by default
- --display-modules
- --display-reasons (where all the modules are used/defined)
- --display-chunks
- any options you can define in
config
can be called on CLI - --watch to recompile assets when surce files change/saved
- -p
- --profile --json >> stats.json (analyzation stuffz)
- require/require.ensure