├── README.md ├── dist └── index.html ├── index.html ├── src └── index.js ├── webpack.config.js ├── package.json └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # webpack-demo -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Output Management 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Wbpack Exercise 7 | 8 | 9 |

Hello webpack!

10 | 11 | 12 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | 3 | function component() { 4 | const element = document.createElement('div'); 5 | 6 | // Lodash, currently included via a script, is required for this line to work 7 | // Lodash, now imported by this script 8 | element.innerHTML = _.join(['Hello', 'webpack'], ' '); 9 | 10 | return element; 11 | } 12 | 13 | document.body.appendChild(component()); -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 2 | const path = require('path'); 3 | module.exports = { 4 | mode:"development", 5 | entry: './src/index.js', 6 | plugins: [ 7 | new HtmlWebpackPlugin({ 8 | title: 'Output Management', 9 | }), 10 | ], 11 | output: { 12 | filename: 'bundle.js', 13 | path: path.resolve(__dirname, 'dist'), 14 | }, 15 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "build": "webpack" 9 | 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/divinecharlotte/webpack-demo.git" 14 | }, 15 | "keywords": [], 16 | "author": "", 17 | "license": "ISC", 18 | "bugs": { 19 | "url": "https://github.com/divinecharlotte/webpack-demo/issues" 20 | }, 21 | "homepage": "https://github.com/divinecharlotte/webpack-demo#readme", 22 | "devDependencies": { 23 | "html-webpack-plugin": "^5.5.0", 24 | "webpack": "^5.72.1", 25 | "webpack-cli": "^4.9.2" 26 | }, 27 | "dependencies": { 28 | "lodash": "^4.17.21" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 divine charlotte 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------