From 0b86431a12a9b74ebeab9ab5e7d8f2862bdb6160 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 30 Oct 2020 07:54:19 +0300 Subject: [PATCH] first commit --- .gitignore | 2 ++ dist/bundle.js | 1 + dist/index.html | 1 + package.json | 24 ++++++++++++++++++++++++ src/index.html | 11 +++++++++++ src/index.js | 5 +++++ src/module.js | 1 + webpack.config.js | 18 ++++++++++++++++++ 8 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 dist/bundle.js create mode 100644 dist/index.html create mode 100644 package.json create mode 100644 src/index.html create mode 100644 src/index.js create mode 100644 src/module.js create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49e0fc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/package-lock.json \ No newline at end of file diff --git a/dist/bundle.js b/dist/bundle.js new file mode 100644 index 0000000..cd94500 --- /dev/null +++ b/dist/bundle.js @@ -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")})()})(); \ No newline at end of file diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..a31f740 --- /dev/null +++ b/dist/index.html @@ -0,0 +1 @@ +JavaScript Constructor

Webpack

\ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..7f91eda --- /dev/null +++ b/package.json @@ -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 ", + "license": "ISC", + "devDependencies": { + "html-webpack-plugin": "^4.5.0", + "webpack": "^5.3.2", + "webpack-cli": "^4.1.0", + "webpack-dev-server": "^3.11.0" + } +} diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..e3cf059 --- /dev/null +++ b/src/index.html @@ -0,0 +1,11 @@ + + + + + + JavaScript Constructor + + +

Webpack

+ + diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..bf794d5 --- /dev/null +++ b/src/index.js @@ -0,0 +1,5 @@ +import './module' + +console.log('index.js') + +document.querySelector('h1').style.color = 'red' diff --git a/src/module.js b/src/module.js new file mode 100644 index 0000000..5aea41e --- /dev/null +++ b/src/module.js @@ -0,0 +1 @@ +console.log('module.js') diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..d5a5a22 --- /dev/null +++ b/webpack.config.js @@ -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' + }) + ] +}