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>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Getting Started</title>
|
<title>Output Management</title>
|
||||||
|
<script src="./print.bundle.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="main.js"></script>
|
<script src="./app.bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import printMe from './print.js';
|
||||||
|
|
||||||
function component() {
|
function component() {
|
||||||
var element = document.createElement('div');
|
var element = document.createElement('div');
|
||||||
|
var btn =document.createElement('button');
|
||||||
|
|
||||||
// Lodash, now imported by this script
|
// Lodash, now imported by this script
|
||||||
element.innerHTML = _.join(['Hello', 'webpack'], ' ');
|
element.innerHTML = _.join(['Hello', 'webpack'], ' ');
|
||||||
|
|
||||||
|
btn.innerHTML = 'Click me and check the console!';
|
||||||
|
btn.onclick= printMe;
|
||||||
|
|
||||||
|
element.appendChild(btn);
|
||||||
|
|
||||||
return element;
|
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');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './src/index.js',
|
entry: {
|
||||||
|
app: './src/index.js',
|
||||||
|
print: './src/print.js'
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: 'main.js',
|
filename: '[name].bundle.js',
|
||||||
path: path.resolve(__dirname, 'dist')
|
path: path.resolve(__dirname, 'dist')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user