diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05f2851 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/node_modules +/dist +!/dist/index.html \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index 3e18a57..e7f9ae4 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,9 +1,10 @@ - Getting Started + Output Management + - + \ No newline at end of file diff --git a/src/index.js b/src/index.js index 662558e..0c0861d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,11 +1,18 @@ import _ from 'lodash'; +import printMe from './print.js'; function component() { var element = document.createElement('div'); + var btn =document.createElement('button'); // Lodash, now imported by this script element.innerHTML = _.join(['Hello', 'webpack'], ' '); + btn.innerHTML = 'Click me and check the console!'; + btn.onclick= printMe; + + element.appendChild(btn); + return element; } diff --git a/src/print.js b/src/print.js new file mode 100644 index 0000000..3ad81f5 --- /dev/null +++ b/src/print.js @@ -0,0 +1,3 @@ +export default function printMe() { + console.log('I get called from print.js!'); + } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 3f392d9..c819758 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,12 @@ const path = require('path'); module.exports = { - entry: './src/index.js', + entry: { + app: './src/index.js', + print: './src/print.js' + }, output: { - filename: 'main.js', + filename: '[name].bundle.js', path: path.resolve(__dirname, 'dist') } }; \ No newline at end of file