An example of using webpack with an Angular project.
See: https://egghead.io/lessons/angularjs-angular-with-webpack-introduction
- Add "engine.io-client": "automattic/engine.io-client" to package.json if you get socket.io compile errors on “npm install”
> npm install webpack webpack-dev-server -D
module.exports = {
entry: "./app/index.js",
output: {
path: __dirname + "/app",
filename: "bundle.js"
}
}
> webpack
<script src="bundle.js"></script>
- note that we are not using "webpack-dev-server" and NOT "node node_modules/.bin/webpack-dev-server"
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --content-base app --progress --colors --port 8090",
"build": "NODE_ENV=production node node_modules/.bin/webpack && cp app/index.html dist/index.html"
},
> npm start
- bundle.js is not created
- webpack serves bundle.js from memory
> npm install angular