From e43c53f561c54a3d1e3ce03061e057250e16e263 Mon Sep 17 00:00:00 2001 From: Kenneth Ashley Edwards Date: Mon, 10 Apr 2017 19:54:10 -0700 Subject: [PATCH] initial webpack config working with bundle --- package.json | 34 ++++++++++++++++++++++++++++++++++ src/app/index.js | 3 +++ src/index.html | 2 +- webpack.config.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 package.json create mode 100644 src/app/index.js create mode 100644 webpack.config.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..236f41d --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "react-playlist", + "version": "1.0.0", + "description": "All the course files for the Net Ninja React tutorial playlist on YouTube", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "npm run build", + "build": "webpack -d && webpack-dev-server --content-base src/ --inline --hot --port 1234 --history-api-fallback" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/rpcvjet/react-playlist.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/rpcvjet/react-playlist/issues" + }, + "homepage": "https://github.com/rpcvjet/react-playlist#readme", + "dependencies": { + "react": "^15.5.3", + "react-dom": "^15.5.3" + }, + "devDependencies": { + "babel-core": "^6.24.1", + "babel-loader": "^6.4.1", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "webpack": "^2.3.3", + "webpack-dev-server": "^2.4.2" + } +} diff --git a/src/app/index.js b/src/app/index.js new file mode 100644 index 0000000..3ffbee3 --- /dev/null +++ b/src/app/index.js @@ -0,0 +1,3 @@ +'use strict'; + +alert('it works'); diff --git a/src/index.html b/src/index.html index 2d26154..29d8bc8 100644 --- a/src/index.html +++ b/src/index.html @@ -5,6 +5,6 @@ React - Novice to Ninja! - + diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..655e920 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,29 @@ +'use strict'; + +var path = require('path'); + +module.exports = { + + entry: path.resolve(__dirname, 'src') + '/app/index.js', + output: { + path: path.resolve(__dirname, 'dist') + '/app', + filename: 'bundle.js', + publicPath: '/app/' + }, + module: { + loaders: [ + { + test: /\.js$/, + include: path.resolve(__dirname, 'src'), + loader: 'babel-loader', + query: { + presets: ['react', 'es2015'] + } + }, + { + test: /\.css$/, + loader: 'style-loader!css-loader' + } + ] + } +};