Skip to content

Commit

Permalink
Preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
zainfathoni committed Feb 27, 2018
1 parent 13bee89 commit 852af9f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dist/index.html
@@ -1,8 +1,9 @@
<html>
<head>
<title>Asset Management</title>
<title>Output Management</title>
<script src="./print.main.js"></script>
</head>
<body>
<script src="main.js"></script>
<script src="./app.main.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions src/index.js
@@ -1,10 +1,17 @@
import _ from 'lodash';
import printMe from './print.js';

function component() {
var element = document.createElement('div');
var btn = document.createElement('button');

element.innerHTML = _.join(['Hello', 'webpack'], ' ');

btn.innerHTML = 'Click me and check the console!';
btn.onclick = printMe;

element.appendChild(btn);

return element;
}

Expand Down
3 changes: 3 additions & 0 deletions src/print.js
@@ -0,0 +1,3 @@
export default function printMe() {
console.log('I get called from print.js!');
}
7 changes: 5 additions & 2 deletions webpack.config.js
Expand Up @@ -2,9 +2,12 @@ const path = require('path');

module.exports = {
mode: 'development',
entry: './src/index.js',
entry: {
app: './src/index.js',
print: './src/print.js'
},
output: {
filename: 'main.js',
filename: '[name].main.js',
path: path.resolve(__dirname, 'dist')
}
}

0 comments on commit 852af9f

Please sign in to comment.