Output Management
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/node_modules
|
||||
/dist
|
||||
!/dist/index.html
|
||||
5
dist/index.html
vendored
5
dist/index.html
vendored
@@ -1,9 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Getting Started</title>
|
||||
<title>Output Management</title>
|
||||
<script src="./print.bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="main.js"></script>
|
||||
<script src="./app.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
3
src/print.js
Normal file
3
src/print.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function printMe() {
|
||||
console.log('I get called from print.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')
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user