Start frontend project
This commit is contained in:
1035
frontend/package-lock.json
generated
Normal file
1035
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
frontend/package.json
Normal file
20
frontend/package.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"webpack": "^5.31.0",
|
||||
"webpack-cli": "^4.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21"
|
||||
}
|
||||
}
|
||||
20
frontend/src/index.js
Normal file
20
frontend/src/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import _ from "lodash";
|
||||
import "./style.css";
|
||||
import Icon from './ship.png';
|
||||
|
||||
function component() {
|
||||
const element = document.createElement("div");
|
||||
|
||||
// Lodash, currently included via a script, is required for this line to work
|
||||
element.innerHTML = _.join(["Hello", "webpack"], " ");
|
||||
element.classList.add("hello");
|
||||
|
||||
const myIcon = new Image();
|
||||
myIcon.src = Icon;
|
||||
|
||||
element.appendChild(myIcon);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
document.body.appendChild(component());
|
||||
9
frontend/webpack.config.js
Normal file
9
frontend/webpack.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
entry: "./src/index.js",
|
||||
output: {
|
||||
filename: "bundle.js",
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user