first commit

This commit is contained in:
Виктор Батищев 2020-10-30 07:54:19 +03:00
commit 0b86431a12
8 changed files with 63 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/node_modules
/package-lock.json

1
dist/bundle.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{var e={852:()=>{console.log("module.js")}},r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={exports:{}};return e[t](n,n.exports,o),n.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{"use strict";o(852),console.log("index.js")})()})();

1
dist/index.html vendored Normal file
View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>JavaScript Constructor</title></head><body><h1>Webpack</h1><script src="bundle.js"></script></body></html>

24
package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "js-constructor",
"version": "1.0.0",
"description": "pure javascript site constructor",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production",
"serve": "webpack serve"
},
"keywords": [
"js",
"webpack",
"javascript"
],
"author": "Victor Batischev <vitek.batishev97@gmail.com>",
"license": "ISC",
"devDependencies": {
"html-webpack-plugin": "^4.5.0",
"webpack": "^5.3.2",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0"
}
}

11
src/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JavaScript Constructor</title>
</head>
<body>
<h1>Webpack</h1>
</body>
</html>

5
src/index.js Normal file
View File

@ -0,0 +1,5 @@
import './module'
console.log('index.js')
document.querySelector('h1').style.color = 'red'

1
src/module.js Normal file
View File

@ -0,0 +1 @@
console.log('module.js')

18
webpack.config.js Normal file
View File

@ -0,0 +1,18 @@
const path = require('path')
var HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
devServer: {
port: 3000
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
})
]
}