commit 366a01ab60b682c2ca8cafccf2eaee2295c21534 Author: Matt Huntington Date: Mon May 15 17:20:27 2017 -0400 webpack basic diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/index.html b/index.html new file mode 100644 index 0000000..fc364f8 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + + + + +
+ + + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..180dcf4 --- /dev/null +++ b/js/index.js @@ -0,0 +1,7 @@ +import ReactDOM from 'react-dom'; +import React from 'react'; + +ReactDOM.render( +

Hello, world!

, + document.querySelector('main') +); diff --git a/js/mylib.js b/js/mylib.js new file mode 100644 index 0000000..b6aa956 --- /dev/null +++ b/js/mylib.js @@ -0,0 +1,18 @@ +const myFunc = function(){ + console.log('included!'); +} + +export default myFunc; + +const myFunc2 = function(){ + console.log('also included'); +} + +const unnecessary = function(){ + console.log('unnecessary'); +} + +export { + myFunc2, + unnecessary as omitme +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b0e41f9 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "webpack-dev-server --open" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "babel-core": "^6.24.1", + "babel-loader": "^7.0.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "react": "^15.5.4", + "react-dom": "^15.5.4", + "webpack": "^2.5.1", + "webpack-dev-server": "^2.4.5" + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..cec9a83 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,19 @@ +module.exports = { + entry: './js/index.js', + output: { + filename: 'dist/bundle.js' + }, + module: { + rules: [ + { + test: /\.(js|jsx)$/, //for all files that end with js/jsx + use: { + loader: 'babel-loader', //use the babel loader to load: + options: { + presets: ["es2015", "react"] + } + } + } + ] + } +};